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 |
|---|---|---|---|---|
SortAscIcon.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... | {
return (
<Icon {...iconProps}>
<path
d="M6.571 12.857q0 0.107-0.089 0.214l-2.848 2.848q-0.089 0.080-0.205 0.080-0.107 0-0.205-0.080l-2.857-2.857q-0.134-0.143-0.063-0.313 0.071-0.179 0.268-0.179h1.714v-12.286q0-0.125 0.080-0.205t0.205-0.080h1.714q0.125 0 0.205 0.080t0.080 0.205v12.286h1.714q0.125 0... | identifier_body | |
SortAscIcon.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... | ({ fill = 'currentColor', ...iconProps }: IconProps) {
return (
<Icon {...iconProps}>
<path
d="M6.571 12.857q0 0.107-0.089 0.214l-2.848 2.848q-0.089 0.080-0.205 0.080-0.107 0-0.205-0.080l-2.857-2.857q-0.134-0.143-0.063-0.313 0.071-0.179 0.268-0.179h1.714v-12.286q0-0.125 0.080-0.205t0.205-0.080h1.714... | SortAscIcon | identifier_name |
SortAscIcon.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, o... | />
</Icon>
);
} | d="M6.571 12.857q0 0.107-0.089 0.214l-2.848 2.848q-0.089 0.080-0.205 0.080-0.107 0-0.205-0.080l-2.857-2.857q-0.134-0.143-0.063-0.313 0.071-0.179 0.268-0.179h1.714v-12.286q0-0.125 0.080-0.205t0.205-0.080h1.714q0.125 0 0.205 0.080t0.080 0.205v12.286h1.714q0.125 0 0.205 0.080t0.080 0.205zM16 14v1.714q0 0.125-0.080... | random_line_split |
angular-locale_de-ch.js | 'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n... | }]); | },
"id": "de-ch",
"localeID": "de_CH",
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
| random_line_split |
angular-locale_de-ch.js | 'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n... | return PLURAL_CATEGORY.OTHER;}
});
}]);
| { return PLURAL_CATEGORY.ONE; } | conditional_block |
angular-locale_de-ch.js | 'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function | (n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f... | getDecimals | identifier_name |
angular-locale_de-ch.js | 'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n... |
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"vorm.",
"nachm."
],
"DAY": [
"Sonntag",
"Montag",
"Dienstag",
"Mittwoch",
"Donnerstag",
"Freitag",
"Samstag"
],
"ERANAMES": [
"v. Chr.",
"n. Chr."
... | {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
} | identifier_body |
sepcomp-fns-backwards.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 ... |
fn main() {
assert_eq!(one(), 1);
assert_eq!(a::two(), 2);
assert_eq!(b::three(), 3);
}
| {
1
} | identifier_body |
sepcomp-fns-backwards.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 ... |
// Test references to items that haven't been translated yet.
// Generate some code in the first compilation unit before declaring any
// modules. This ensures that the first module doesn't go into the same
// compilation unit as the top-level module.
fn pad() -> usize { 0 }
mod b {
pub fn three() -> usize {
... | // except according to those terms.
// ignore-bitrig
// compile-flags: -C codegen-units=3 | random_line_split |
sepcomp-fns-backwards.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 ... | () -> usize {
1
}
fn main() {
assert_eq!(one(), 1);
assert_eq!(a::two(), 2);
assert_eq!(b::three(), 3);
}
| one | identifier_name |
task-comm-10.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 ... | (c: &comm::Chan<comm::Chan<~str>>) {
let (p, ch) = comm::stream();
c.send(ch);
let mut a;
let mut b;
a = p.recv();
assert!(a == ~"A");
error!("{:?}", a);
b = p.recv();
assert!(b == ~"B");
error!("{:?}", b);
}
pub fn main() {
let (p, ch) = comm::stream();
let _child = ta... | start | identifier_name |
task-comm-10.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | let mut b;
a = p.recv();
assert!(a == ~"A");
error!("{:?}", a);
b = p.recv();
assert!(b == ~"B");
error!("{:?}", b);
}
pub fn main() {
let (p, ch) = comm::stream();
let _child = task::spawn(proc() start(&ch) );
let c = p.recv();
c.send(~"A");
c.send(~"B");
task::des... |
let mut a; | random_line_split |
task-comm-10.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
pub fn main() {
let (p, ch) = comm::stream();
let _child = task::spawn(proc() start(&ch) );
let c = p.recv();
c.send(~"A");
c.send(~"B");
task::deschedule();
}
| {
let (p, ch) = comm::stream();
c.send(ch);
let mut a;
let mut b;
a = p.recv();
assert!(a == ~"A");
error!("{:?}", a);
b = p.recv();
assert!(b == ~"B");
error!("{:?}", b);
} | identifier_body |
STM32F429IDISCOVERY.py | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | ():
pins = pinutils.scan_pin_file([], 'stm32f40x.csv', 6, 9, 10)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"])
| get_pins | identifier_name |
STM32F429IDISCOVERY.py | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | pins = pinutils.scan_pin_file([], 'stm32f40x.csv', 6, 9, 10)
return pinutils.only_from_package(pinutils.fill_gaps_in_pin_list(pins), chip["package"]) | identifier_body | |
STM32F429IDISCOVERY.py | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | 'pin_d8' : 'E11',
'pin_d9' : 'E12',
'pin_d10' : 'E13',
'pin_d11' : 'E14',
'pin_d12' : 'E15',
'pin_a0' : 'F0',
'pin_a1' : 'F1',
'pin_a2' : 'F2',
'pin_a3' : 'F3',
'pin_a4' : 'F4',
'pin_a5' :... | 'pin_d4' : 'E7',
'pin_d5' : 'E8',
'pin_d6' : 'E9',
'pin_d7' : 'E10', | random_line_split |
lib.rs | }
/// Sets the *debug* flag for the OpenGL [`Context`].
///
/// The default value for this flag is `cfg!(debug_assertions)`, which means
/// that it's enabled when you run `cargo build` and disabled when you run
/// `cargo build --release`.
///
/// [`Context`]: struct.Context.html
#... | {
/// The classical OpenGL. Available on Windows, Unix operating systems,
/// OS/X.
OpenGl,
/// OpenGL embedded system. Available on Unix operating systems, Android.
OpenGlEs,
/// OpenGL for the web. Very similar to OpenGL ES.
WebGl,
}
/// Describes the requested OpenGL [`Context`] profile... | Api | identifier_name |
lib.rs |
}
/// Sets the *debug* flag for the OpenGL [`Context`].
///
/// The default value for this flag is `cfg!(debug_assertions)`, which means
/// that it's enabled when you run `cargo build` and disabled when you run
/// `cargo build --release`.
///
/// [`Context`]: struct.Context.html
... | ///
/// Will panic if `samples` is not a power of two.
#[inline]
pub fn with_multisampling(mut self, samples: u16) -> Self {
self.pf_reqs.multisampling = match samples {
0 => None,
_ => {
assert!(samples.is_power_of_two());
Some(samples)
... |
/// Sets the multisampling level to request. A value of `0` indicates that
/// multisampling must not be enabled.
///
/// # Panic | random_line_split |
jquery.addresspicker.js | /*
* jQuery UI addresspicker @VERSION
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.autocomple... |
},
_initMap: function() {
this.gmap = new google.maps.Map(this.$mapElement, this.options.mapOptions);
this.gmarker = new google.maps.Marker({
position: this.options.mapOptions.center,
map:this.gmap,
draggable: this.options.dragga... | } | random_line_split |
jquery.addresspicker.js | /*
* jQuery UI addresspicker @VERSION
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
* jquery.ui.autocomple... |
},
_addressSelected: function(evt, gMapsLocation) {
console.dir(gMapsLocation);
this.selectedResult = gMapsLocation;
},
_locationSelected: function(evt, LatLng) {
}
};
$.fn.addresspicker = function (option, val) {
return this.each(fun... | {
this.gmarker.setPosition(gMapsLocation.geometry.location);
this.gmarker.setVisible(true);
this.gmap.fitBounds(gMapsLocation.geometry.viewport);
} | conditional_block |
JSONFormatter_test.ts | // Copyright 2021 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.
const {assert} = chai;
import * as FormatterWorker from '../../../../../front_end/entrypoints/formatter_worker/formatter_worker.js';
function formatJSON... | "t": 46.0000018736184
}
],
"ix": 6
}
},
"ao": 0,
"ip": 0,
"op": 9890.00040282796,
"st": 0,
"bm": 0
}`;
assert.strictEqual(formattedCode, expectedCode);
});
}); | 103,
100
]
},
{ | random_line_split |
JSONFormatter_test.ts | // Copyright 2021 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.
const {assert} = chai;
import * as FormatterWorker from '../../../../../front_end/entrypoints/formatter_worker/formatter_worker.js';
function | (text: string): string {
return FormatterWorker.FormatterWorker.format('application/json', text, ' ').content;
}
describe('JSONFormatter', () => {
it('formats simple json objects correctly', () => {
const formattedCode = formatJSON('{"people":[{"firstName":"Joe","lastName":"Jackson","age":28}]}');
const e... | formatJSON | identifier_name |
JSONFormatter_test.ts | // Copyright 2021 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.
const {assert} = chai;
import * as FormatterWorker from '../../../../../front_end/entrypoints/formatter_worker/formatter_worker.js';
function formatJSON... |
describe('JSONFormatter', () => {
it('formats simple json objects correctly', () => {
const formattedCode = formatJSON('{"people":[{"firstName":"Joe","lastName":"Jackson","age":28}]}');
const expectedCode = `{
"people": [
{
"firstName": "Joe",
"lastName": "Jackson",
"age": 28
}
... | {
return FormatterWorker.FormatterWorker.format('application/json', text, ' ').content;
} | identifier_body |
pool.rs | use wio::com::ComPtr;
use dxguid;
use std::ptr;
use std::os::raw::c_void;
use winapi;
use hal::pool;
use command::CommandBuffer;
use {Backend, CmdSignatures};
pub struct RawCommandPool {
pub(crate) inner: ComPtr<winapi::ID3D12CommandAllocator>,
pub(crate) device: ComPtr<winapi::ID3D12Device>,
pub(crate) l... | self.inner.clone(),
self.signatures.clone(),
))
.collect()
}
unsafe fn free(&mut self, _cbufs: Vec<CommandBuffer>) {
// Just let the command buffers drop
}
}
pub struct SubpassCommandPool;
impl pool::SubpassCommandPool<Backend> for SubpassCom... |
fn allocate(&mut self, num: usize) -> Vec<CommandBuffer> {
(0..num)
.map(|_| CommandBuffer::new(
self.create_command_list(), | random_line_split |
pool.rs | use wio::com::ComPtr;
use dxguid;
use std::ptr;
use std::os::raw::c_void;
use winapi;
use hal::pool;
use command::CommandBuffer;
use {Backend, CmdSignatures};
pub struct RawCommandPool {
pub(crate) inner: ComPtr<winapi::ID3D12CommandAllocator>,
pub(crate) device: ComPtr<winapi::ID3D12Device>,
pub(crate) l... | (&mut self) {
unsafe { self.inner.Reset(); }
}
fn allocate(&mut self, num: usize) -> Vec<CommandBuffer> {
(0..num)
.map(|_| CommandBuffer::new(
self.create_command_list(),
self.inner.clone(),
self.signatures.clone(),
))
... | reset | identifier_name |
pool.rs | use wio::com::ComPtr;
use dxguid;
use std::ptr;
use std::os::raw::c_void;
use winapi;
use hal::pool;
use command::CommandBuffer;
use {Backend, CmdSignatures};
pub struct RawCommandPool {
pub(crate) inner: ComPtr<winapi::ID3D12CommandAllocator>,
pub(crate) device: ComPtr<winapi::ID3D12Device>,
pub(crate) l... |
}
pub struct SubpassCommandPool;
impl pool::SubpassCommandPool<Backend> for SubpassCommandPool {}
| {
// Just let the command buffers drop
} | identifier_body |
pool.rs | use wio::com::ComPtr;
use dxguid;
use std::ptr;
use std::os::raw::c_void;
use winapi;
use hal::pool;
use command::CommandBuffer;
use {Backend, CmdSignatures};
pub struct RawCommandPool {
pub(crate) inner: ComPtr<winapi::ID3D12CommandAllocator>,
pub(crate) device: ComPtr<winapi::ID3D12Device>,
pub(crate) l... |
unsafe { ComPtr::new(command_list) }
};
// Close command list as they are initiated as recording.
// But only one command list can be recording for each allocator
unsafe { command_list.Close(); }
command_list
}
}
unsafe impl Send for RawCommandPool { }
impl ... | {
error!("error on command list creation: {:x}", hr);
} | conditional_block |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | (Package):
"""Picard is a set of command line tools for manipulating high-throughput
sequencing (HTS) data and formats such as SAM/BAM/CRAM and VCF.
"""
homepage = "http://broadinstitute.github.io/picard/"
url = "https://github.com/broadinstitute/picard/releases/download/2.9.2/picard.jar"
... | Picard | identifier_name |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | if version < Version('2.6.0'):
return self._oldurlfmt.format(version)
else:
return self._urlfmt.format(version) | identifier_body | |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | return self._urlfmt.format(version) | conditional_block | |
package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | return self._oldurlfmt.format(version)
else:
return self._urlfmt.format(version) | run_env.prepend_path('PICARD',
join_path(self.prefix, 'bin', 'picard.jar'))
def url_for_version(self, version):
if version < Version('2.6.0'): | random_line_split |
rollup.config.js | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const resolve = require('rollup-plugin-node-resolve');
const sourcemaps = require('rollup-plugin-sourcemaps');
cons... | globals: globals
}; | random_line_split | |
untitledTextEditorHint.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | private readonly commandService: ICommandService,
private readonly configurationService: IConfigurationService,
private readonly keybindingService: IKeybindingService,
) {
this.toDispose = [];
this.toDispose.push(editor.onDidChangeModelContent(() => this.onDidChangeModelContent()));
this.toDispose.push(thi... | private toDispose: IDisposable[];
constructor(
private readonly editor: ICodeEditor, | random_line_split |
untitledTextEditorHint.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | implements IEditorContribution {
public static readonly ID = 'editor.contrib.untitledTextEditorHint';
private toDispose: IDisposable[];
private untitledTextHintContentWidget: UntitledTextEditorHintContentWidget | undefined;
constructor(
private editor: ICodeEditor,
@ICommandService private readonly commandS... | UntitledTextEditorHintContribution | identifier_name |
untitledTextEditorHint.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
private onDidChangeModelContent(): void {
if (this.editor.getValue() === '') {
this.editor.addContentWidget(this);
} else {
this.editor.removeContentWidget(this);
}
}
getId(): string {
return UntitledTextEditorHintContentWidget.ID;
}
// Select a language to get started. Start typing to dismiss, o... | {
this.toDispose = [];
this.toDispose.push(editor.onDidChangeModelContent(() => this.onDidChangeModelContent()));
this.toDispose.push(this.editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {
if (this.domNode && e.hasChanged(EditorOption.fontInfo)) {
this.editor.applyFontInfo(this.domNode);
... | identifier_body |
untitledTextEditorHint.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
}));
}
private update(): void {
this.untitledTextHintContentWidget?.dispose();
const configValue = this.configurationService.getValue(untitledTextEditorHintSetting);
const model = this.editor.getModel();
if (model && model.uri.scheme === Schemas.untitled && model.getLanguageId() === PLAINTEXT_LANGUAGE_ID... | {
this.update();
} | conditional_block |
Battle.py | #!/usr/bin/env python2
import time
import random
class Battle:
def __init__(self, user1, user2):
self.user1 = user1
self.user2 = user2
self.turn = user1
self.notTurn = user2
self.accepted = False
self.finished = False
self.auto = False
self.turnCount... | (self):
if self.finished:
self.user1.battle = None
self.user2.battle = None
return False
elif self.auto and self.turnCount % 2 == 0:
time.sleep(2)
return self.fight(self.turn.getActivePokemon().spells[random.randint(0, len(self.turn.getActivePo... | nextStep | identifier_name |
Battle.py | #!/usr/bin/env python2
import time
import random
class Battle:
def __init__(self, user1, user2):
self.user1 = user1
self.user2 = user2
self.turn = user1
self.notTurn = user2
self.accepted = False
self.finished = False
self.auto = False
self.turnCount... |
message += attacker.name + " gagne " + str(attacker.calcGainedExp(defender)) + " points d'experience. "
old = attacker.level
attacker.gainExp(defender)
if attacker.level != old:
message += attacker.name + " passe niveau " + str(attacker.level) + "!"
... | message += self.notTurn.username + " a perdu. " + self.turn.username + " a gagne. " | conditional_block |
Battle.py | #!/usr/bin/env python2
import time
import random
class Battle:
def __init__(self, user1, user2):
self.user1 = user1
self.user2 = user2
self.turn = user1
self.notTurn = user2
self.accepted = False
self.finished = False
self.auto = False
self.turnCount... |
def nextStep(self):
if self.finished:
self.user1.battle = None
self.user2.battle = None
return False
elif self.auto and self.turnCount % 2 == 0:
time.sleep(2)
return self.fight(self.turn.getActivePokemon().spells[random.randint(0, len... | self.turn, self.notTurn = self.notTurn, self.turn | identifier_body |
Battle.py | #!/usr/bin/env python2
import time
import random
class Battle:
def __init__(self, user1, user2):
self.user1 = user1
self.user2 = user2
self.turn = user1
self.notTurn = user2
self.accepted = False
self.finished = False
self.auto = False
self.turnCount... | return message
def itemUsed(self):
self.turn, self.notTurn = self.notTurn, self.turn
def nextStep(self):
if self.finished:
self.user1.battle = None
self.user2.battle = None
return False
elif self.auto and self.turnCount % 2 == 0:
... | if attacker.level != old:
message += attacker.name + " passe niveau " + str(attacker.level) + "!"
self.finished = True
self.turn, self.notTurn = self.notTurn, self.turn
self.turnCount += 1 | random_line_split |
basic.js | in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permi... | /*
Copyright (c) 2011, Chris Umbel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal | random_line_split | |
sblim_sfcb.py | #!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wang... | (self, test_path=''):
"""
Sets the overall failure counter for the test.
"""
self.nfail = 0
if not sm.check_installed('gcc'):
logging.debug("gcc missing - trying to install")
sm.install('gcc')
ret_val = subprocess.Popen(['make', 'all'], cwd="%s/sbl... | initialize | identifier_name |
sblim_sfcb.py | #!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wang... |
def postprocess(self):
if self.nfail != 0:
logging.info('\n nfails is non-zero')
raise error.TestError('\nTest failed')
else:
logging.info('\n Test completed successfully ')
| """
Trigger test run
"""
try:
os.environ["LTPBIN"] = "%s/shared" %(test_path)
ret_val = subprocess.Popen(['./sblim-sfcb-test.sh'], cwd="%s/sblim_sfcb" %(test_path))
ret_val.communicate()
if ret_val.returncode != 0:
self.nfail += 1
... | identifier_body |
sblim_sfcb.py | #!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wang... |
except error.CmdError, e:
self.nfail += 1
logging.error("Test Failed: %s", e)
def postprocess(self):
if self.nfail != 0:
logging.info('\n nfails is non-zero')
raise error.TestError('\nTest failed')
else:
logging.info('\n Test com... | self.nfail += 1 | conditional_block |
sblim_sfcb.py | #!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test): |
"""
Autotest module for testing basic functionality
of sblim_sfcb
@author Wang Tao <wangttao@cn.ibm.com>
"""
version = 1
nfail = 0
path = ''
def initialize(self, test_path=''):
"""
Sets the overall failure counter for the test.
"""
self.nfail = 0
... | random_line_split | |
addClarificationAnswerForm.js | import React from 'react';
import { connect } from 'react-redux';
import { reduxForm, clearSubmitErrors } from 'redux-form';
import PropTypes from 'prop-types';
import Snackbar from 'material-ui/Snackbar';
import GridColumn from '../../../common/grid/gridColumn';
import TextFieldForm from '../../../forms/textFieldForm'... | <form onSubmit={handleSubmit}>
<GridColumn >
<TextFieldForm
fieldName="title"
textFieldProps={{
multiline: true,
InputProps: {
inputProps: {
maxLength: '5000',
},
},
}}
label={messag... | const { handleSubmit, error, clearError, form } = props;
return ( | random_line_split |
vasp_raman.py | #
if scale > 0.0:
b = [[ b[i][j]*scale for i in range(3)] for j in range(3) ]
scale = 1.0
#
vol = b[0][0]*b[1][1]*b[2][2] + b[1][0]*b[2][1]*b[0][2] + b[2][0]*b[0][1]*b[1][2] - \
b[0][2]*b[1][1]*b[2][0] - b[2][1]*b[1][2]*b[0][0] - b[2][2]*b[0][1]*b[1][0]
else:
... | inp_fh.readline() # skip title
scale = float(inp_fh.readline())
for i in range(3): b.append( [float(s) for s in inp_fh.readline().split()] ) | random_line_split | |
vasp_raman.py | ().split()]
nat = sum(atom_numbers)
#
poscar_header += "%15.12f\n" % scale
poscar_header += "%15.12f %15.12f %15.12f\n" % (b[0][0], b[0][1], b[0][2])
poscar_header += "%15.12f %15.12f %15.12f\n" % (b[1][0], b[1][1], b[1][2])
poscar_header += "%15.12f %15.12f %15.12f\n" % (b[2][0], b[2][1], b[2][... | (params):
import sys
#
tmp = params.strip().split('_')
if len(tmp) != 4:
print "[parse_env_params]: ERROR there should be exactly four parameters"
sys.exit(1)
#
[first, last, nderiv, step_size] = [int(tmp[0]), int(tmp[1]), int(tmp[2]), float(tmp[3])]
#
return first, last,... | parse_env_params | identifier_name |
vasp_raman.py | print "[parse_poscar]: ERROR negative scale not implemented."
vol = scale
sys.exit(1)
#
atom_labels = inp_fh.readline() # yes, it is hardcoded for VASP5
atom_numbers = [int(s) for s in inp_fh.readline().split()]
nat = sum(atom_numbers)
#
poscar_header += "%15.12f\n" % sca... | import sys
from math import sqrt
#
inp_fh.seek(0) # just in case
poscar_header = ""
vol = 0.0
b = []
atom_numbers = []
#
inp_fh.readline() # skip title
scale = float(inp_fh.readline())
for i in range(3): b.append( [float(s) for s in inp_fh.readline().split()] )
#
if s... | identifier_body | |
vasp_raman.py | SQRT(mass)" in line:
outcar_fh.readline() # empty line
outcar_fh.readline() # Eigenvectors and eigenvalues of the dynamical matrix
outcar_fh.readline() # ----------------------------------------------------
outcar_fh.readline() # empty line
#
for ... | print "[__main__]: Running VASP..."
os.system(VASP_RAMAN_RUN)
try:
move('OUTCAR', disp_filename)
except IOError:
print "[__main__]: ERROR Couldn't find OUTCAR file, exiting..."
sys.exit(1)... | conditional_block | |
noparse.js | var browserify = require('../');
var test = require('tap').test;
var path = require('path');
test('noParse array', function (t) {
t.plan(2);
var actual = []; | ].map(function (x) {return path.resolve(x);}).sort();
var b = browserify({
entries: [ __dirname + '/noparse/a.js' ],
noParse: [
__dirname + '/noparse/dir1/1.js',
__dirname + '/noparse/node_modules/robot/main.js'
]
});
b.on('dep', function(dep) { actua... | var expected = [
'noparse/a.js',
'noparse/b.js',
'noparse/dir1/1.js',
'noparse/node_modules/robot/main.js' | random_line_split |
__init__.py | # Copyright (C) 2015 Trustcode - www.trustcode.com.br #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU Affero General Public License as published by #
... | # -*- encoding: utf-8 -*-
###############################################################################
# # | random_line_split | |
misc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
"""Wrapper for all miscellaneous functions and classes from psychopy.tools |
from __future__ import absolute_import, print_function
from psychopy.tools.arraytools import (createXYs, extendArr, makeRadialMatrix,
ratioRange, shuffleArray, val2array)
from psychopy.tools.attributetools import (attributeSetter, setAttribute,
... | """
# pylint: disable=W0611
# W0611 = Unused import %s | random_line_split |
cursorEvents.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... | (desiredScrollTop: number) {
this.desiredScrollTop = desiredScrollTop;
}
}
| constructor | identifier_name |
cursorEvents.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
/**
* @internal
*/
export const CursorEventType = {
CursorPositionChanged: 'positionChanged',
CursorSelectionChanged: 'selectionChanged',
Cu... |
'use strict'; | random_line_split |
ax-configure.spec.js | /**
* Copyright 2015 aixigo AG
* Released under the MIT license.
* http://laxarjs.org/license
*/
var path = require( 'path' );
var grunt = require( 'grunt' );
var runTask = require( 'grunt-run-task' );
var expect = require( 'expect.js' );
var run = require( './lib/run-elsewhere' );
var spyOn = require( './lib/spy-... |
configSpy = spyOn( runTask.grunt.config, 'set' );
run( 'laxar-configure', taskConfig, dir.actual, done );
} );
after( function() {
configSpy.reset();
} );
////////////////////////////////////////////////////////////////////////////////////////////////////////
... | {
grunt.file.delete( paths.actual.result );
} | conditional_block |
ax-configure.spec.js | /**
* Copyright 2015 aixigo AG
* Released under the MIT license.
* http://laxarjs.org/license
*/
var path = require( 'path' );
var grunt = require( 'grunt' );
var runTask = require( 'grunt-run-task' );
var expect = require( 'expect.js' );
var run = require( './lib/run-elsewhere' );
var spyOn = require( './lib/spy-... | var taskConfig = {
options: {
base: dir.actual,
workDirectory: project.work,
flows: [
{ target: 'my-flow', src: project.flow }
]
}
};
//////////////////////////////////////////////////////////////////////////////////////... | ///////////////////////////////////////////////////////////////////////////////////////////////////////////
describe( 'configured for a single flow', function() {
| random_line_split |
ax-configure.spec.js | /**
* Copyright 2015 aixigo AG
* Released under the MIT license.
* http://laxarjs.org/license
*/
var path = require( 'path' );
var grunt = require( 'grunt' );
var runTask = require( 'grunt-run-task' );
var expect = require( 'expect.js' );
var run = require( './lib/run-elsewhere' );
var spyOn = require( './lib/spy-... |
} );
| {
return function ( callargs ) {
return callargs[ 0 ] === task;
};
} | identifier_body |
ax-configure.spec.js | /**
* Copyright 2015 aixigo AG
* Released under the MIT license.
* http://laxarjs.org/license
*/
var path = require( 'path' );
var grunt = require( 'grunt' );
var runTask = require( 'grunt-run-task' );
var expect = require( 'expect.js' );
var run = require( './lib/run-elsewhere' );
var spyOn = require( './lib/spy-... | ( task ) {
return function ( callargs ) {
return callargs[ 0 ] === task;
};
}
} );
| configures | identifier_name |
signer.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... | #[rpc(name = "signer_rejectRequest")]
fn reject_request(&self, U256) -> Result<bool, Error>;
/// Generates new authorization token.
#[rpc(name = "signer_generateAuthorizationToken")]
fn generate_token(&self) -> Result<String, Error>;
/// Generates new web proxy access token.
#[rpc(name = "signer_generat... | fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse, Error>;
/// Reject the confirmation request. | random_line_split |
ex3_nytimes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This exercise shows some important concepts that you should be aware about:
- using codecs module to write unicode files
- using authentication with web APIs
- using offset when accessing web APIs
To run this code locally you have to register at the NYTimes developer s... | API_KEY = { "popular": "8f59290cf487b2c40b3bbac5de38049c:17:72343821",
"article": "c3b8c7101c497404c903a3e1691ea96d:2:72343821"}
def get_from_file(kind, period):
filename = "popular-{0}-{1}.json".format(kind, period)
with open(filename, "r") as f:
return json.loads(f.read())
def article_... | URL_MAIN = "http://api.nytimes.com/svc/"
URL_POPULAR = URL_MAIN + "mostpopular/v2/" | random_line_split |
ex3_nytimes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This exercise shows some important concepts that you should be aware about:
- using codecs module to write unicode files
- using authentication with web APIs
- using offset when accessing web APIs
To run this code locally you have to register at the NYTimes developer s... |
print len(titles)
print len(urls)
return (titles, urls)
def query_site(url, target, offset):
# This will set up the query with the API key and offset
# Web services often use offset parameter to return data in small chunks
# NYTimes returns 20 articles per request, if you want the next 20
... | media_metadata_list = media_metadata_container['media-metadata']
for media_metadata in media_metadata_list:
if media_metadata['format'] == "Standard Thumbnail":
urls.append(media_metadata['url']) | conditional_block |
ex3_nytimes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This exercise shows some important concepts that you should be aware about:
- using codecs module to write unicode files
- using authentication with web APIs
- using offset when accessing web APIs
To run this code locally you have to register at the NYTimes developer s... |
def article_overview(kind, period):
data = get_from_file(kind, period)
#data = get_popular(URL_POPULAR, kind, period)
titles = []
urls =[]
for article in data:
title_dic = {}
title_dic[article['section']] = article['title']
titles.append(title_dic)
media_list = ar... | filename = "popular-{0}-{1}.json".format(kind, period)
with open(filename, "r") as f:
return json.loads(f.read()) | identifier_body |
ex3_nytimes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This exercise shows some important concepts that you should be aware about:
- using codecs module to write unicode files
- using authentication with web APIs
- using offset when accessing web APIs
To run this code locally you have to register at the NYTimes developer s... | (kind, period):
filename = "popular-{0}-{1}.json".format(kind, period)
with open(filename, "r") as f:
return json.loads(f.read())
def article_overview(kind, period):
data = get_from_file(kind, period)
#data = get_popular(URL_POPULAR, kind, period)
titles = []
urls =[]
for article i... | get_from_file | identifier_name |
dynamic_costs_example.py | ###########################################################################
#
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/l... | 'range':'A2:B'
},
'out':{
'auth':auth_write,
'dataset':bigquery_dataset
}
})
if __name__ == "__main__":
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent("""
Calculate DV360 cost at the dynamic creative ... | random_line_split | |
dynamic_costs_example.py | ###########################################################################
#
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/l... | (config, dcm_account, auth_read, configuration_sheet_url, auth_write, bigquery_dataset):
"""Calculate DV360 cost at the dynamic creative combination level.
Args:
dcm_account (string) - NA
auth_read (authentication) - Credentials used for reading data.
configuration_sheet_url (string) - NA
... | recipe_dynamic_costs | identifier_name |
dynamic_costs_example.py | ###########################################################################
#
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/l... |
parser.add_argument("-project", help="Cloud ID of Google Cloud Project.", default=None)
parser.add_argument("-key", help="API Key of Google Cloud Project.", default=None)
parser.add_argument("-client", help="Path to CLIENT credentials json file.", default=None)
parser.add_argument("-user", help="Path to USER c... | parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent("""
Calculate DV360 cost at the dynamic creative combination level.
1. Add a sheet URL. This is where you will enter advertiser and campaign level details.
2. Specify the CM net... | conditional_block |
dynamic_costs_example.py | ###########################################################################
#
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/l... | 'tab':'Dynamic Costs',
'range':'A2:B'
},
'out':{
'auth':auth_write,
'dataset':bigquery_dataset
}
})
if __name__ == "__main__":
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent("""
Calculate DV360... | """Calculate DV360 cost at the dynamic creative combination level.
Args:
dcm_account (string) - NA
auth_read (authentication) - Credentials used for reading data.
configuration_sheet_url (string) - NA
auth_write (authentication) - Credentials used for writing data.
bigquery_data... | identifier_body |
__init__.py | #!/usr/bin/env python
#############################################################
# ubi_reader/ubi_io
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... | class leb_virtual_file():
def __init__(self, ubi, volume):
self._ubi = ubi
self._volume = volume
self._blocks = sort.by_leb(self._volume.get_blocks(self._ubi.blocks))
self._seek = 0
self.leb_data_size = len(self._blocks) * self._ubi.leb_size
self._last_leb = -1
... | random_line_split | |
__init__.py | #!/usr/bin/env python
#############################################################
# ubi_reader/ubi_io
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... |
elif self.end_offset and self.end_offset - cur_loc < self.block_size:
chunk_size = self.end_offset - cur_loc
else:
chunk_size = self.block_size
buf = self.read(chunk_size)
if not buf:
break
yield buf
def ... | break | conditional_block |
__init__.py | #!/usr/bin/env python
#############################################################
# ubi_reader/ubi_io
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... |
def read_block_data(self, block):
"""Read LEB data from file
Argument:
Obj:block -- Block data is desired for.
"""
self.seek(block.file_offset + block.ec_hdr.data_offset)
buf = self._fhandle.read(block.size - block.ec_hdr.data_offset - block.vid_hdr.data_pad)
... | """Read complete PEB data from file.
Argument:
Obj:block -- Block data is desired for.
"""
self.seek(block.file_offset)
return self._fhandle.read(block.size) | identifier_body |
__init__.py | #!/usr/bin/env python
#############################################################
# ubi_reader/ubi_io
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Founda... | (self, i):
buf = ''
leb = int(self.tell() / self._ubi.leb_size)
offset = self.tell() % self._ubi.leb_size
if leb == self._last_leb:
self.seek(self.tell() + i)
return self._last_buf[offset:offset + i]
else:
buf = self._ubi.file.read_block_data(... | read | identifier_name |
config.py | # Copyright 2015 OpenStack Foundation.
#
# 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... | cfg.StrOpt('auth_region',
help=_("Authentication region")),
cfg.BoolOpt('auth_insecure',
default=False,
help=_("Turn off verification of the certificate for"
" ssl")),
cfg.StrOpt('auth_ca_cert',
help=_("Certificate ... | help=_("Authentication URL")),
cfg.StrOpt('auth_strategy', default='keystone',
help=_("The type of authentication to use")), | random_line_split |
setting.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import BaseHandler
import os
import sys
sys.path.append('..')
from models.user import User
class ChangeHandler(BaseHandler):
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
error=""
if len(... | User.change(user[0].uid,uname,password,profile,hpic,sex)
self.redirect("/change") | with open(save_dir+hpic,'wb') as up:
up.write(pic['body']) | random_line_split |
setting.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import BaseHandler
import os
import sys
sys.path.append('..')
from models.user import User
class | (BaseHandler):
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
error=""
if len(user) > 0:
self.render("change.html",user=user,error=error)
else:
self.redirect("/login")
def post(self):
ok = False
... | ChangeHandler | identifier_name |
setting.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import BaseHandler
import os
import sys
sys.path.append('..')
from models.user import User
class ChangeHandler(BaseHandler):
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
error=""
if len(... | self.render("change.html",error=error,user=user)
if 'image' in self.request.files:
pic = self.request.files['image'][0]
ext = pic['filename'].split('.').pop()
if ext not in ext_allowed:
error="图片格式不支持"
se... | ok = False
uname = self.get_current_user()
user = User.get_user_by_name(uname)
ext_allowed = ['gif', 'jpg', 'jpeg', 'png']
hpic = user[0].hpic
max_size = 2621440
save_dir = os.path.join(os.path.dirname(__file__), "../public/pic/hpic/")
if len(user)>0:
... | identifier_body |
setting.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import BaseHandler
import os
import sys
sys.path.append('..')
from models.user import User
class ChangeHandler(BaseHandler):
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
error=""
if len(... | error="图片太大"
self.render("change.html",error=error,user=user)
hpic = file_name+"."+ext
with open(save_dir+hpic,'wb') as up:
up.write(pic['body'])
User.change(user[0].uid,uname,password,profile,hpic,sex)
s... | file_name = str(user[0].uid)
password = self.get_argument("password")
uname = self.get_argument("uname")
rpassword = self.get_argument("rpassword")
sex = self.get_argument("gender")
profile = self.get_argument("profile")
error = ""
if p... | conditional_block |
__manifest__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of medical_medicament,
# an Odoo module.
# | # Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# medical_medicament is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of ME... | # Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# medical_medicament is free software:
# you can redistribute it and/or modify it under the terms of the GNU | random_line_split |
ms.js | /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/autoload/ms.js
*
* Implements the HTML-CSS output for <ms> elements.
*
* --------------------------------... |
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.7.0";
var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
MML.ms.Augment({
toHTML: function (span) {
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
var values = this.getVal... | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | random_line_split |
bubble.js | * TODO: support decoration and addChild
*/
goog.provide('goog.ui.Bubble');
goog.require('goog.Timer');
goog.require('goog.dom.safe');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.html.SafeHtml');
goog.require('goog.math.Box');
goog.require('goog.positioning');
goog.require(... | * @fileoverview Definition of the Bubble class.
*
*
* @see ../demos/bubble.html
* | random_line_split | |
bubble.js | * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper.
* @constructor
* @extends {goog.ui.Component}
*/
goog.ui.Bubble = function(message, opt_config, opt_domHelper) {
goog.ui.Component.call(this, opt_domHelper);
if (goog.isString(message)) {
message = goog.html.SafeHtml.htmlEscape(message);
}... |
if (this.timerId_) {
goog.Timer.clear(this.timerId_);
this.timerId_ = null;
}
var element = this.getElement();
if (element) {
this.getDomHelper().removeChildren(element);
goog.dom.safe.setInnerHtml(element, goog.html.SafeHtml.EMPTY);
}
};
/**
* Computes bubble position based on anchored e... | {
goog.events.unlistenByKey(this.listener_);
this.listener_ = null;
} | conditional_block |
grouper.js | const NON_WORD_REGEXP = /[^A-Za-z0-9]/g
export const DEFAULT_RANGES = ['0-9', 'A-B', 'C-D', 'E-F', 'G-H', 'I-J', 'K-L', 'M-N', 'O-P', 'Q-R', 'S-T', 'U-V', 'W-X', 'Y-Z']
export function groupBrandsByRanges (brands, ranges = DEFAULT_RANGES) {
let rangeBrandsHash = {}
for (let brand of brands) {
addBrandToRange... |
export function stringsAreInDescendingOrder (s1, s2, equality = false) {
if (equality) { return normalizeString(s1) >= normalizeString(s2) }
return normalizeString(s1) > normalizeString(s2)
}
export function stringsAreInAscendingOrder (s1, s2, equality = false) {
if (equality) { return normalizeString(s1) <= n... | {
return s.replace(NON_WORD_REGEXP, '').toLowerCase()
} | identifier_body |
grouper.js |
export const DEFAULT_RANGES = ['0-9', 'A-B', 'C-D', 'E-F', 'G-H', 'I-J', 'K-L', 'M-N', 'O-P', 'Q-R', 'S-T', 'U-V', 'W-X', 'Y-Z']
export function groupBrandsByRanges (brands, ranges = DEFAULT_RANGES) {
let rangeBrandsHash = {}
for (let brand of brands) {
addBrandToRangedBrandHash(rangeBrandsHash, brand, range... | const NON_WORD_REGEXP = /[^A-Za-z0-9]/g | random_line_split | |
grouper.js | const NON_WORD_REGEXP = /[^A-Za-z0-9]/g
export const DEFAULT_RANGES = ['0-9', 'A-B', 'C-D', 'E-F', 'G-H', 'I-J', 'K-L', 'M-N', 'O-P', 'Q-R', 'S-T', 'U-V', 'W-X', 'Y-Z']
export function | (brands, ranges = DEFAULT_RANGES) {
let rangeBrandsHash = {}
for (let brand of brands) {
addBrandToRangedBrandHash(rangeBrandsHash, brand, ranges)
}
return rangeBrandsHash
}
export function addBrandToRangedBrandHash (rangeBrandsHash, brand, ranges = DEFAULT_RANGES) {
const range = getBrandRange(brand.... | groupBrandsByRanges | identifier_name |
grouper.js | const NON_WORD_REGEXP = /[^A-Za-z0-9]/g
export const DEFAULT_RANGES = ['0-9', 'A-B', 'C-D', 'E-F', 'G-H', 'I-J', 'K-L', 'M-N', 'O-P', 'Q-R', 'S-T', 'U-V', 'W-X', 'Y-Z']
export function groupBrandsByRanges (brands, ranges = DEFAULT_RANGES) {
let rangeBrandsHash = {}
for (let brand of brands) {
addBrandToRange... |
}
| {
brandFastInsert(brands, brand, m + 1, r)
return
} | conditional_block |
exploration-draft.model.ts | // Copyright 2017 The Oppia Authors. 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 by ap... | }
// TODO(xxx): Add more discrimination and create multiple versions of this
// interface, each with a different 'state_name'.
export interface ExplorationChangeEditStateProperty {
'cmd': 'edit_state_property';
'new_value': SubtitledHtmlBackendDict |
InteractionBackendDict |
ParamChangeBackendDict[] |
... |
export interface ExplorationChangeDeleteState {
'cmd': 'delete_state';
'state_name': string; | random_line_split |
exploration-draft.model.ts | // Copyright 2017 The Oppia Authors. 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 by ap... |
/**
* Checks whether the draft object has been overwritten by another
* draft which has been committed to the back-end. If the supplied draft id
* has a different value then a newer changeList must have been committed
* to the back-end.
* @param {Integer} - currentDraftId. The id of the draft changes... | {
this.draftChanges = draftChanges;
this.draftChangeListId = draftChangeListId;
} | identifier_body |
exploration-draft.model.ts | // Copyright 2017 The Oppia Authors. 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 by ap... | (
draftChanges: ExplorationChange[], draftChangeListId: number) {
this.draftChanges = draftChanges;
this.draftChangeListId = draftChangeListId;
}
/**
* Checks whether the draft object has been overwritten by another
* draft which has been committed to the back-end. If the supplied draft id
*... | constructor | identifier_name |
kqueue.rs | , intptr_t};
use std::io::Result;
use event::Event;
use notification::Notification;
use user_event::UserEvent;
use nix_err_to_io_err;
type UserData = intptr_t;
static KQUEUE_EVENT_SIZE: usize = 1024;
pub struct KernelPoller {
kqueue: RawFd,
registrar: KernelRegistrar,
eventlist: Vec<KEvent>,
notifica... | (&mut self) {
for e in self.eventlist.drain(..) {
let event = event_from_filter(e.filter());
let new_notification = Notification {
id: e.udata() as usize,
event: event.clone()
};
let mut notification = self.notifications.entry(e.id... | coalesce_events | identifier_name |
kqueue.rs | api compatibility with epoll.
pub fn get_registrar(&self) -> KernelRegistrar {
self.registrar.clone()
}
// Wait for kevents and return a list of Notifications. Coalesce reads and writes for the same
// socket into a single notification. If only a read or a write event for a given socket is
... | {
let mut flags = EventFlag::EV_ADD;
if !recurring {
flags |= EventFlag::EV_ONESHOT;
}
let ev = KEvent::new(
id as uintptr_t,
EventFilter::EVFILT_TIMER,
flags,
FilterFlag::empty(), // timeouts are in ms by default
timeout as intptr_t,
id as UserDat... | identifier_body | |
kqueue.rs | _t, intptr_t};
use std::io::Result;
use event::Event;
use notification::Notification;
use user_event::UserEvent;
use nix_err_to_io_err;
type UserData = intptr_t;
static KQUEUE_EVENT_SIZE: usize = 1024;
pub struct KernelPoller {
kqueue: RawFd,
registrar: KernelRegistrar,
eventlist: Vec<KEvent>,
notifi... | Ok(self.notifications.drain().map(|(_, v)| v).collect())
}
// Combine read and write events for the same socket into a single notification.
fn coalesce_events(&mut self) {
for e in self.eventlist.drain(..) {
let event = event_from_filter(e.filter());
let new_notifica... | random_line_split | |
owned.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
| use std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use context::CoreContext;
use mononoke_types::ChangesetId;
use crate::idmap::IdMap;
use crate::read_only::ReadOnlySegmentedChangelog;
use crate::{segmented_changelog_delegate, SegmentedChangelog};
use crate::{CloneData, InProcessIdDag, Location};
... | use std::collections::HashMap; | random_line_split |
owned.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::collections::HashMap;
use std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use context::CoreContext;
use monono... | (iddag: InProcessIdDag, idmap: Arc<dyn IdMap>) -> Self {
Self { iddag, idmap }
}
}
segmented_changelog_delegate!(OwnedSegmentedChangelog, |&self, ctx: &CoreContext| {
ReadOnlySegmentedChangelog::new(&self.iddag, self.idmap.clone())
});
| new | identifier_name |
owned.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use std::collections::HashMap;
use std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use context::CoreContext;
use monono... |
}
segmented_changelog_delegate!(OwnedSegmentedChangelog, |&self, ctx: &CoreContext| {
ReadOnlySegmentedChangelog::new(&self.iddag, self.idmap.clone())
});
| {
Self { iddag, idmap }
} | identifier_body |
menu.module.ts | /*
"l'Agenda Collaboratif"
Copyright (C) 2016 Valentin VIENNOT
Contact : vviennot@orange.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | (public _sync: SyncService,
private _date: DateService,
private _parse: ParseService) {
this.sections = [];
}
ngOnInit(): void {
this.sync();
this.interval = IntervalObservable.create(60000).subscribe((t) => this.sync());
}
ngOnDestroy(): void {
this.interval.unsubs... | constructor | identifier_name |
menu.module.ts | /*
"l'Agenda Collaboratif"
Copyright (C) 2016 Valentin VIENNOT
Contact : vviennot@orange.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | j++;
} else {
retour.push({
titre: date.getDate().toString(),
sous_titre: this._date.getDayTiny(date),
devoirs: [],
mois: null
});
}
date.setDate(date.getDate() + 1);
}
return retour;
}
}
@NgModule({
imports: [CommonModule, ... | retour.push(sections[j]); | random_line_split |
menu.module.ts | /*
"l'Agenda Collaboratif"
Copyright (C) 2016 Valentin VIENNOT
Contact : vviennot@orange.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... | se {
retour.push({
titre: date.getDate().toString(),
sous_titre: this._date.getDayTiny(date),
devoirs: [],
mois: null
});
}
date.setDate(date.getDate() + 1);
}
return retour;
}
}
@NgModule({
imports: [CommonModule, RouterModule, TooltipMo... | retour.push(sections[j]);
j++;
} el | conditional_block |
menu.module.ts | /*
"l'Agenda Collaboratif"
Copyright (C) 2016 Valentin VIENNOT
Contact : vviennot@orange.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your optio... |
private sync(): void {
console.log("Mise à jour du semainier...");
let sections = Section.getSections(this.getDevoirs(), this._date).sections;
this.sections = this.transformSections(sections);
}
private getDevoirs(): Devoir[] {
// Récupère les devoirs depuis le localStorage
return this._par... | {
this.interval.unsubscribe();
} | identifier_body |
emulate.ts | ///<reference path="../.d.ts"/>
"use strict";
export class EmulateCommandBase {
constructor(private $platformService: IPlatformService) { }
executeCore(args: string[]): IFuture<void> {
return this.$platformService.deployOnEmulator(args[0]);
}
}
| constructor($platformService: IPlatformService,
private $platformsData: IPlatformsData) {
super($platformService);
}
public allowedParameters: ICommandParameter[] = [];
public execute(args: string[]): IFuture<void> {
return this.executeCore([this.$platformsData.availablePlatforms.iOS]);
}
}
$injector.regis... | export class EmulateIosCommand extends EmulateCommandBase implements ICommand { | random_line_split |
emulate.ts | ///<reference path="../.d.ts"/>
"use strict";
export class EmulateCommandBase {
constructor(private $platformService: IPlatformService) |
executeCore(args: string[]): IFuture<void> {
return this.$platformService.deployOnEmulator(args[0]);
}
}
export class EmulateIosCommand extends EmulateCommandBase implements ICommand {
constructor($platformService: IPlatformService,
private $platformsData: IPlatformsData) {
super($platformService);
}
pu... | { } | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.