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 |
|---|---|---|---|---|
temporary_roles.rs | use crate::database::{
schema::*,
models::U64,
};
insertable! {
#[derive(Debug, Queryable, Identifiable, AsChangeset)]
pub struct TemporaryRole,
#[derive(Debug, Insertable)]
#[table_name = "temporary_roles"]
pub struct NewTemporaryRole {
pub guild_id: U64,
pub user_id: U64,
pub role_id: U64,
... |
}
| {
NewTemporaryRole {
guild_id: guild_id.into(),
user_id: user_id.into(),
role_id: role_id.into(),
message_id: message_id.into(),
channel_id: channel_id.map(|x| x as i64),
messages,
expires_on,
}
} | identifier_body |
temporary_roles.rs | use crate::database::{
schema::*,
models::U64,
};
insertable! {
#[derive(Debug, Queryable, Identifiable, AsChangeset)]
pub struct TemporaryRole,
#[derive(Debug, Insertable)]
#[table_name = "temporary_roles"]
pub struct NewTemporaryRole {
pub guild_id: U64,
pub user_id: U64,
pub role_id: U64,
... | (guild_id: u64, user_id: u64, role_id: u64, message_id: u64, channel_id: Option<u64>, messages: Option<i32>, expires_on: Option<i64>) -> Self {
NewTemporaryRole {
guild_id: guild_id.into(),
user_id: user_id.into(),
role_id: role_id.into(),
message_id: message_id.into(),
channel_id: cha... | new | identifier_name |
temporary_roles.rs | use crate::database::{
schema::*,
models::U64,
};
insertable! {
#[derive(Debug, Queryable, Identifiable, AsChangeset)]
pub struct TemporaryRole,
#[derive(Debug, Insertable)]
#[table_name = "temporary_roles"]
pub struct NewTemporaryRole {
pub guild_id: U64,
pub user_id: U64,
pub role_id: U64,
... | impl NewTemporaryRole {
pub fn new(guild_id: u64, user_id: u64, role_id: u64, message_id: u64, channel_id: Option<u64>, messages: Option<i32>, expires_on: Option<i64>) -> Self {
NewTemporaryRole {
guild_id: guild_id.into(),
user_id: user_id.into(),
role_id: role_id.into(),
message_id: mess... | random_line_split | |
guide-tour.js | var nextButton = {name: "<em>N</em>ext", classString: "btn-next", onclick: guiders.next},
closeButton = {name: "<em>C</em>lose", classString: "btn-close", onclick: onCloseCallBack},
prevButton = {name: "<em>P</em>revious", classString: "btn-prv", onclick: guiders.prev};
// STEP #1 : Présentation
guiders.create... | guiders.createGuider({
//attachTo: "div.champions-handler-container ul#isotope-list li.champion",
buttons: [prevButton, nextButton, closeButton],
description: "Click on any champion to view their statistics at level 1, their purchase price in influence points and riot points.",
id: "second",
next: "third",
... | // STEP #2 : Aperçu champion | random_line_split |
Reset.tsx | // part:@sanity/base/reset-icon
import React from 'react'
| stroke: 'currentColor',
strokeWidth: 1.2,
}
const ResetIcon = () => (
<svg
data-sanity-icon
viewBox="0 0 25 25"
fill="none"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid"
width="1em"
height="1em"
>
<path d="M9.50001 15.5L15.5 9.49999" style={strokeStyle} />
... | const strokeStyle = { | random_line_split |
time.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 ipc_channel::ipc;
use profile::time;
use profile_traits::ipc as ProfiledIpc;
use profile_traits::time::{Profil... | time::Profiler::get_statistics(&unsorted_data);
}
#[cfg(debug_assertions)]
#[test]
#[should_panic]
fn time_profiler_data_len_zero() {
let zero_data = vec![];
time::Profiler::get_statistics(&zero_data);
} | fn time_profiler_unsorted_stats_test() {
let unsorted_data = vec![5.0, 7.5, 1.0, 8.9]; | random_line_split |
time.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 ipc_channel::ipc;
use profile::time;
use profile_traits::ipc as ProfiledIpc;
use profile_traits::time::{Profil... |
#[test]
fn channel_profiler_test() {
let chan = time::Profiler::create(&Some(OutputOptions::Stdout(5.0)), None);
let (profiled_sender, profiled_receiver) = ProfiledIpc::channel(chan.clone()).unwrap();
thread::spawn(move || {
thread::sleep(Duration::from_secs(2));
profiled_sender.send(43).u... | {
let even_data = vec![1.234, 3.24567, 3.54578, 5.0, 5.324, 7.345,
9.2345, 10.2342345, 13.2599, 15.0];
let (even_mean, even_median, even_min, even_max) = time::Profiler::get_statistics(&even_data);
assert_eq!(7.34230845, even_mean);
assert_eq!(7.345, even_median);
assert_eq... | identifier_body |
time.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 ipc_channel::ipc;
use profile::time;
use profile_traits::ipc as ProfiledIpc;
use profile_traits::time::{Profil... | () {
let chan = time::Profiler::create(&None, None);
assert!(true, "Can create the profiler thread");
let (ipcchan, _ipcport) = ipc::channel().unwrap();
chan.send(ProfilerMsg::Exit(ipcchan));
assert!(true, "Can tell the profiler thread to exit");
}
#[test]
fn time_profiler_stats_test() {
let e... | time_profiler_smoke_test | identifier_name |
non_blocking.rs | //! A demonstration of constructing and using a non-blocking stream.
//!
//! Audio from the default input device is passed directly to the default output device in a duplex
//! stream, so beware of feedback!
extern crate portaudio;
use portaudio as pa;
const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES: u32 = 256;
con... |
};
// Construct a stream with input and output sample types of f32.
let mut stream = try!(pa.open_non_blocking_stream(settings, callback));
try!(stream.start());
// Loop while the non-blocking stream is active.
while let true = try!(stream.is_active()) {
// Do some stuff!
wh... | { pa::Complete } | conditional_block |
non_blocking.rs | //! A demonstration of constructing and using a non-blocking stream.
//!
//! Audio from the default input device is passed directly to the default output device in a duplex
//! stream, so beware of feedback!
extern crate portaudio;
use portaudio as pa;
const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES: u32 = 256;
con... | let latency = output_info.default_low_output_latency;
let output_params = pa::StreamParameters::new(def_output, CHANNELS, INTERLEAVED, latency);
// Check that the stream format is supported.
try!(pa.is_duplex_format_supported(input_params, output_params, SAMPLE_RATE));
// Construct the settings wi... | let output_info = try!(pa.device_info(def_output));
println!("Default output device info: {:#?}", &output_info);
// Construct the output stream parameters. | random_line_split |
non_blocking.rs | //! A demonstration of constructing and using a non-blocking stream.
//!
//! Audio from the default input device is passed directly to the default output device in a duplex
//! stream, so beware of feedback!
extern crate portaudio;
use portaudio as pa;
const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES: u32 = 256;
con... |
fn run() -> Result<(), pa::Error> {
let pa = try!(pa::PortAudio::new());
println!("PortAudio:");
println!("version: {}", pa.version());
println!("version text: {:?}", pa.version_text());
println!("host count: {}", try!(pa.host_api_count()));
let default_host = try!(pa.default_host_api());
... | {
run().unwrap()
} | identifier_body |
non_blocking.rs | //! A demonstration of constructing and using a non-blocking stream.
//!
//! Audio from the default input device is passed directly to the default output device in a duplex
//! stream, so beware of feedback!
extern crate portaudio;
use portaudio as pa;
const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES: u32 = 256;
con... | () -> Result<(), pa::Error> {
let pa = try!(pa::PortAudio::new());
println!("PortAudio:");
println!("version: {}", pa.version());
println!("version text: {:?}", pa.version_text());
println!("host count: {}", try!(pa.host_api_count()));
let default_host = try!(pa.default_host_api());
print... | run | identifier_name |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Minigan(Package):
"""miniGAN is a generative adversarial network code developed as part of... | depends_on('py-torchvision', type=('build', 'run'))
depends_on('py-matplotlib@3.0.0', type=('build', 'run'))
def install(self, spec, prefix):
install_tree('.', prefix) | depends_on('py-horovod@master', type=('build', 'run')) | random_line_split |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Minigan(Package):
"""miniGAN is a generative adversarial network code developed as part of... | install_tree('.', prefix) | identifier_body | |
package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class | (Package):
"""miniGAN is a generative adversarial network code developed as part of the
Exascale Computing Project's (ECP) ExaLearn project at
Sandia National Laboratories."""
homepage = "https://github.com/SandiaMLMiniApps/miniGAN"
url = "https://github.com/SandiaMLMiniApps/miniGAN/archive/1.... | Minigan | identifier_name |
status.ts | import { createFixture } from '../create-fixture';
export function stagedRenamed(from = 'from.ext', to = 'to.ext', workingDir = ' ') {
return `R${workingDir} ${from} -> ${to}`;
}
export function stagedRenamedWithModifications(from = 'from.ext', to = 'to.ext') {
return stagedRenamed(from, to, 'M');
}
export fun... | } | random_line_split | |
status.ts | import { createFixture } from '../create-fixture';
export function stagedRenamed(from = 'from.ext', to = 'to.ext', workingDir = ' ') {
return `R${workingDir} ${from} -> ${to}`;
}
export function stagedRenamedWithModifications(from = 'from.ext', to = 'to.ext') {
return stagedRenamed(from, to, 'M');
}
export fun... | (file = 'staged-deleted.ext') {
return `D ${file}`;
}
export function unStagedDeleted(file = 'un-staged-deleted.ext') {
return ` D ${file}`;
}
export function stagedModified(file = 'staged-modified.ext') {
return `M ${file}`;
}
export function stagedIgnored(file = 'ignored.ext') {
return `!! ${file}`;
... | stagedDeleted | identifier_name |
status.ts | import { createFixture } from '../create-fixture';
export function stagedRenamed(from = 'from.ext', to = 'to.ext', workingDir = ' ') {
return `R${workingDir} ${from} -> ${to}`;
}
export function stagedRenamedWithModifications(from = 'from.ext', to = 'to.ext') {
return stagedRenamed(from, to, 'M');
}
export fun... |
export function stagedModified(file = 'staged-modified.ext') {
return `M ${file}`;
}
export function stagedIgnored(file = 'ignored.ext') {
return `!! ${file}`;
}
export function statusResponse(branch = 'main', ...files: Array<string | (() => string)>) {
const stdOut: string[] = [
`## ${branch}`,
... | {
return ` D ${file}`;
} | identifier_body |
SessionManager.test.tsx | import * as path from "path"
import {
ISession,
SessionManager,
UpdatedOni,
} from "./../browser/src/Services/Sessions/SessionManager"
import Oni from "./mocks/Oni"
import Sidebar from "./mocks/Sidebar"
jest.mock("./../browser/src/Services/Configuration/UserConfiguration", () => ({
getUserConfigFolde... | (key: string) {
delete this._store[key]
return new Promise(resolve => resolve(this._store))
},
has(key) {
return !!this._store[key]
},
}
describe("Session Manager Tests", () => {
const persistentStore = mockPersistentStore
const oni = new Oni({})
const manager = new Sess... | delete | identifier_name |
SessionManager.test.tsx | import * as path from "path"
import {
ISession,
SessionManager,
UpdatedOni,
} from "./../browser/src/Services/Sessions/SessionManager"
import Oni from "./mocks/Oni"
import Sidebar from "./mocks/Sidebar"
jest.mock("./../browser/src/Services/Configuration/UserConfiguration", () => ({
getUserConfigFolde... | set(obj: { [key: string]: any }) {
return new Promise(resolve => {
this._store = { ...this._store, ...obj }
resolve(null)
})
},
delete(key: string) {
delete this._store[key]
return new Promise(resolve => resolve(this._store))
},
has(key) {
... | resolve(this._store || {})
})
}, | random_line_split |
SessionManager.test.tsx | import * as path from "path"
import {
ISession,
SessionManager,
UpdatedOni,
} from "./../browser/src/Services/Sessions/SessionManager"
import Oni from "./mocks/Oni"
import Sidebar from "./mocks/Sidebar"
jest.mock("./../browser/src/Services/Configuration/UserConfiguration", () => ({
getUserConfigFolde... | ,
set(obj: { [key: string]: any }) {
return new Promise(resolve => {
this._store = { ...this._store, ...obj }
resolve(null)
})
},
delete(key: string) {
delete this._store[key]
return new Promise(resolve => resolve(this._store))
},
has(key) {
... | {
return new Promise((resolve, reject) => {
resolve(this._store || {})
})
} | identifier_body |
product_supplierinfo.py | # -*- coding: utf-8 -*-
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
import openerp.addons.dec... | supplierinfo.name.default_supplierinfo_discount | random_line_split | |
product_supplierinfo.py | # -*- coding: utf-8 -*-
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
import openerp.addons.dec... | pplierinfo.discount =\
supplierinfo.name.default_supplierinfo_discount
| conditional_block | |
product_supplierinfo.py | # -*- coding: utf-8 -*-
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
import openerp.addons.dec... | elf):
for supplierinfo in self.filtered('name'):
supplierinfo.discount =\
supplierinfo.name.default_supplierinfo_discount
| change_name(s | identifier_name |
product_supplierinfo.py | # -*- coding: utf-8 -*-
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
import openerp.addons.dec... | nherit = 'product.supplierinfo'
discount = fields.Float(
string='Discount (%)', digits_compute=dp.get_precision('Discount'))
@api.onchange('name')
@api.multi
def onchange_name(self):
for supplierinfo in self.filtered('name'):
supplierinfo.discount =\
supplie... | identifier_body | |
file-attachment.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... |
if (fileName.match(/^.+\.(ppt|pptx|odp)$/)) {
return 'fa-file-powerpoint';
}
if (fileName.match(/^.+\.(avi|mkv|mov|webm)$/)) {
return 'fa-file-video';
}
if (fileName.match(/^.+\.(doc|docx|odt)$/)) {
return 'fa-file-word';
}
return 'fa-file';
}
| {
return 'fa-file-pdf';
} | conditional_block |
file-attachment.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... | (fileName: string): string {
if (fileName.match(/^.+\.(txt|log)$/)) {
return 'fa-file-alt';
}
if (fileName.match(/^.+\.(zip|war|jar|rar|gz|7z)$/)) {
return 'fa-file-archive';
}
if (fileName.match(/^.+\.(aac|ogg|mp3|wma)$/)) {
return 'fa-file-audio';
}
if (fileName.match(/^.+\.(java|js|ts|c|... | getFileTypeIcon | identifier_name |
file-attachment.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... |
if (fileName.match(/^.+\.(jpg|jpeg|png|svg|tiff|gif|bmp|webp)$/)) {
return 'fa-file-image';
}
if (fileName.match(/^.+\.(pdf)$/)) {
return 'fa-file-pdf';
}
if (fileName.match(/^.+\.(ppt|pptx|odp)$/)) {
return 'fa-file-powerpoint';
}
if (fileName.match(/^.+\.(avi|mkv|mov|webm)$/)) {
retu... | {
if (fileName.match(/^.+\.(txt|log)$/)) {
return 'fa-file-alt';
}
if (fileName.match(/^.+\.(zip|war|jar|rar|gz|7z)$/)) {
return 'fa-file-archive';
}
if (fileName.match(/^.+\.(aac|ogg|mp3|wma)$/)) {
return 'fa-file-audio';
}
if (fileName.match(/^.+\.(java|js|ts|c|cpp|html|xhtml|css|scss|les... | identifier_body |
file-attachment.utils.ts | /*
* Lumeer: Modern Data Definition and Processing Platform
*
* Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates.
*
* 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 ... | if (fileName.match(/^.+\.(pdf)$/)) {
return 'fa-file-pdf';
}
if (fileName.match(/^.+\.(ppt|pptx|odp)$/)) {
return 'fa-file-powerpoint';
}
if (fileName.match(/^.+\.(avi|mkv|mov|webm)$/)) {
return 'fa-file-video';
}
if (fileName.match(/^.+\.(doc|docx|odt)$/)) {
return 'fa-file-word';
}
... | return 'fa-file-image';
}
| random_line_split |
siphash.py | #!/usr/bin/env python3
# Copyright (c) 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def rotl64... | v0 = (v0 + v1) & ((1 << 64) - 1)
v1 = rotl64(v1, 13)
v1 ^= v0
v0 = rotl64(v0, 32)
v2 = (v2 + v3) & ((1 << 64) - 1)
v3 = rotl64(v3, 16)
v3 ^= v2
v0 = (v0 + v3) & ((1 << 64) - 1)
v3 = rotl64(v3, 21)
v3 ^= v0
v2 = (v2 + v1) & ((1 << 64) - 1)
v1 = rotl64(v1, 17)
v1 ^= v2
... |
def siphash_round(v0, v1, v2, v3): | random_line_split |
siphash.py | #!/usr/bin/env python3
# Copyright (c) 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def rotl64... |
def siphash256(k0, k1, h):
n0 = h & ((1 << 64) - 1)
n1 = (h >> 64) & ((1 << 64) - 1)
n2 = (h >> 128) & ((1 << 64) - 1)
n3 = (h >> 192) & ((1 << 64) - 1)
v0 = 0x736f6d6570736575 ^ k0
v1 = 0x646f72616e646f6d ^ k1
v2 = 0x6c7967656e657261 ^ k0
v3 = 0x7465646279746573 ^ k1 ^ n0
v0, v1, ... | v0 = (v0 + v1) & ((1 << 64) - 1)
v1 = rotl64(v1, 13)
v1 ^= v0
v0 = rotl64(v0, 32)
v2 = (v2 + v3) & ((1 << 64) - 1)
v3 = rotl64(v3, 16)
v3 ^= v2
v0 = (v0 + v3) & ((1 << 64) - 1)
v3 = rotl64(v3, 21)
v3 ^= v0
v2 = (v2 + v1) & ((1 << 64) - 1)
v1 = rotl64(v1, 17)
v1 ^= v2
... | identifier_body |
siphash.py | #!/usr/bin/env python3
# Copyright (c) 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def | (n, b):
return n >> (64 - b) | (n & ((1 << (64 - b)) - 1)) << b
def siphash_round(v0, v1, v2, v3):
v0 = (v0 + v1) & ((1 << 64) - 1)
v1 = rotl64(v1, 13)
v1 ^= v0
v0 = rotl64(v0, 32)
v2 = (v2 + v3) & ((1 << 64) - 1)
v3 = rotl64(v3, 16)
v3 ^= v2
v0 = (v0 + v3) & ((1 << 64) - 1)
v3 ... | rotl64 | identifier_name |
errors_test.js | var expect = require('chai').expect;
var errors = require('../lib/Errors');
describe('Errors', function() {
it('maps status codes to custom errors', function() {
var unauthorized = errors('401');
expect(unauthorized.name).to.eq('Error');
expect(unauthorized.type).to.eq('AuthenticationError');
expect(... | expect(rateLimited.type).to.eq('TooManyRequestsError');
expect(rateLimited.message).to.eq('foo');
expect(rateLimited.stack).to.be.a('string');
expect(rateLimited.retryAfter).to.eq(5);
});
}); | var rateLimited = errors('429', 'foo', { retryAfter: 5 });
expect(rateLimited.name).to.eq('Error'); | random_line_split |
Types.ts | /**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
// Note: Need to use a type here, as types are iterable whereas inter... | poster: DialogSubData;
embed?: string;
dimensions?: {
width?: string;
height?: string;
};
} | export interface MediaDialogData {
source: DialogSubData;
altsource: DialogSubData; | random_line_split |
TimeTrigger.ts | /**
* 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/.
*/
import * as Events from '../Events';
import Trigger, { TriggerDescription } from './Trigger';
export interfa... | export default class TimeTrigger extends Trigger {
private time: string;
private localized: boolean;
private timeout: NodeJS.Timeout | null;
private _sendOn: () => void;
private _sendOff: () => void;
constructor(desc: TimeTriggerDescription) {
super(desc);
this.time = desc.time;
this.locali... | }
/**
* An abstract class for triggers whose input is a single property
*/ | random_line_split |
TimeTrigger.ts | /**
* 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/.
*/
import * as Events from '../Events';
import Trigger, { TriggerDescription } from './Trigger';
export interfa... | extends Trigger {
private time: string;
private localized: boolean;
private timeout: NodeJS.Timeout | null;
private _sendOn: () => void;
private _sendOff: () => void;
constructor(desc: TimeTriggerDescription) {
super(desc);
this.time = desc.time;
this.localized = !!desc.localized;
this... | TimeTrigger | identifier_name |
TimeTrigger.ts | /**
* 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/.
*/
import * as Events from '../Events';
import Trigger, { TriggerDescription } from './Trigger';
export interfa... |
stop(): void {
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout = null;
}
}
}
| {
this.emit(Events.STATE_CHANGED, { on: false, value: Date.now() });
this.scheduleNext();
} | identifier_body |
TimeTrigger.ts | /**
* 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/.
*/
import * as Events from '../Events';
import Trigger, { TriggerDescription } from './Trigger';
export interfa... |
}
}
| {
clearTimeout(this.timeout);
this.timeout = null;
} | conditional_block |
hw_day_6_task_12.py | import os
from faker import Faker
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from wheel.signatures... | request.addfinalizer(wd.quit)
return wd
def test_add_new_product(driver):
wait = WebDriverWait(driver, 5)
f = Faker()
driver.get("http://localhost/litecart/admin")
driver.find_element_by_name("username").send_keys("admin")
driver.find_element_by_name("password").send_keys("admin")
dri... | wd = webdriver.Chrome()
wd.implicitly_wait(2) | random_line_split |
hw_day_6_task_12.py | import os
from faker import Faker
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from wheel.signatures... | (request):
wd = webdriver.Chrome()
wd.implicitly_wait(2)
request.addfinalizer(wd.quit)
return wd
def test_add_new_product(driver):
wait = WebDriverWait(driver, 5)
f = Faker()
driver.get("http://localhost/litecart/admin")
driver.find_element_by_name("username").send_keys("admin")
d... | driver | identifier_name |
hw_day_6_task_12.py | import os
from faker import Faker
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from wheel.signatures... |
def test_add_new_product(driver):
wait = WebDriverWait(driver, 5)
f = Faker()
driver.get("http://localhost/litecart/admin")
driver.find_element_by_name("username").send_keys("admin")
driver.find_element_by_name("password").send_keys("admin")
driver.find_element_by_name("login").click()
... | wd = webdriver.Chrome()
wd.implicitly_wait(2)
request.addfinalizer(wd.quit)
return wd | identifier_body |
hw_day_6_task_12.py | import os
from faker import Faker
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from wheel.signatures... |
product_quantity = tab_general.find_element(By.NAME, "quantity")
product_quantity.clear()
product_quantity.send_keys(30)
upload_image_field = tab_general.find_element(By.NAME, "new_images[]")
path = os.path.normcase('tests/day_6/images/dark_blue_duck.png')
absolute_path = os.path.abspath(path... | if category.get_attribute('checked') == "true":
category.click()
if category.get_attribute('data-name') == check:
category.click() | conditional_block |
segmentgraph.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::io::Write;
use clidispatch::errors;
use cliparser::define_flags;
use dag::render::render_segment_dag;
use super::Repo;
use super... | {
"display segment graph for a given group and level"
} | identifier_body | |
segmentgraph.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::io::Write;
use clidispatch::errors;
use cliparser::define_flags;
use dag::render::render_segment_dag;
use super::Repo;
use super... | Ok(level) => level,
_ => return Err(errors::Abort("invalid level".into()).into()),
};
let mut out = io.output();
write!(out, "{}, Level: {}\n", group, level)?;
let dag = dag::Dag::open(repo.store_path().join("segments/v1"))?;
render_segment_dag(out, &dag, level, group)?;
Ok(0)... | };
let level: dag::Level = match opts.level.try_into() { | random_line_split |
segmentgraph.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::io::Write;
use clidispatch::errors;
use cliparser::define_flags;
use dag::render::render_segment_dag;
use super::Repo;
use super... | () -> &'static str {
"debugsegmentgraph"
}
pub fn doc() -> &'static str {
"display segment graph for a given group and level"
}
| name | identifier_name |
account.games.controller.js | (function () {
'use strict';
angular
.module('webApp')
.controller('AccountGamesController', accountGamesController);
accountGamesController.$inject = ['TranslationFactory',
'WebAppConstants',
'GamelinkService',
... |
}
})();
| {
vm.creategamelink.region = '';
for (var i = 0; i < vm.supportedgames.length; i++){
if (vm.creategamelink.game == vm.supportedgames[i].ID){
vm.regionlist = vm.supportedgames[i].REGIONS;
return;
}
}
v... | identifier_body |
account.games.controller.js | (function () {
'use strict';
angular
.module('webApp')
.controller('AccountGamesController', accountGamesController);
accountGamesController.$inject = ['TranslationFactory',
'WebAppConstants',
'GamelinkService',
... |
vm.regionlist = [];
}
}
})();
| {
if (vm.creategamelink.game == vm.supportedgames[i].ID){
vm.regionlist = vm.supportedgames[i].REGIONS;
return;
}
} | conditional_block |
account.games.controller.js | (function () {
'use strict';
angular
.module('webApp')
.controller('AccountGamesController', accountGamesController);
accountGamesController.$inject = ['TranslationFactory',
'WebAppConstants',
'GamelinkService',
... | (){
GamelinkService.fetchGamelinks();
}
function createGamelink(){
function success(){
fetchUserAccountGames();
}
GamelinkService.createGamelink(vm.creategamelink, success);
}
function buildRegionList(){
vm.cre... | fetchUserAccountGames | identifier_name |
account.games.controller.js | (function () {
'use strict';
angular
.module('webApp')
.controller('AccountGamesController', accountGamesController);
accountGamesController.$inject = ['TranslationFactory',
'WebAppConstants',
'GamelinkService',
... | var vm = this;
vm.translation = TranslationFactory.messages;
vm.supportedgames = WebAppConstants.GAME_LIST;
vm.gameslinks = GamelinksListFactory.instance;
vm.regionlist = [];
vm.creategamelink = {};
vm.fetchUserAccountGames = fetchUserAccountGames;
vm.bu... | WebAppConstants,
GamelinkService,
GamelinksListFactory) {
/* jshint validthis: true */ | random_line_split |
oojs-ui-wikimediaui.js | /*!
* OOjs UI v0.25.0
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2018 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
* Date: 2018-01-10T00:26:02Z
*/
( function ( OO ) {
'use strict';
/**
* @class
* @extends OO.ui.Theme
*
* @construct... | // Frameless disabled button, always use black icon / indicator regardless of other flags
variants.invert = false;
} else if ( !element.isDisabled() ) {
// Any other kind of button, use the right colored icon / indicator if available
variants.progressive = element.hasFlag( 'progressive' );
variants.des... | random_line_split | |
create_env_modal_spec.tsx | /*
* Copyright 2022 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | () {
envJSON = data.environment_json();
const environmentsJSON = {
_embedded: {
environments: [envJSON]
}
};
modal = new CreateEnvModal(jasmine.createSpy("onSuccessfulSave"), Stream(Environments.fromJSON(environmentsJSON)));
helper.mount(modal.vie... | mountModal | identifier_name |
create_env_modal_spec.tsx | /*
* Copyright 2022 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | const inputField = helper.byTestId("form-field-input-environment-name");
helper.oninput(inputField, envJSON.name);
helper.clickByTestId("button-save");
expect(helper.q(`#${inputField.id}-error-text`)).toHaveText("Name is a duplicate.");
});
}); | random_line_split | |
create_env_modal_spec.tsx | /*
* Copyright 2022 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
beforeEach(() => {
mountModal();
});
afterEach(() => {
helper.unmount();
});
it("should get modal title", () => {
expect(modal.title()).toEqual("Add New Environment");
});
it("should render create env modal", () => {
const infoMessageText = "Pipelines, agents and environment variables... | {
envJSON = data.environment_json();
const environmentsJSON = {
_embedded: {
environments: [envJSON]
}
};
modal = new CreateEnvModal(jasmine.createSpy("onSuccessfulSave"), Stream(Environments.fromJSON(environmentsJSON)));
helper.mount(modal.view.b... | identifier_body |
anagramsCalculate.py | from __future__ import print_function
import pandas as pd
import os | print(os.getcwd()) #os.chdir() If using within psychopy, might start out in wrong directory
dir='words_from_databases/'
fname = '8letterWordsFromElexicon'
#Read in all the words (downloaded before from Elexicon
words=pd.read_csv(dir+fname+'.csv')
#Read in all the words with half as many letters
wordsHalfAsManyLtrs = pd... |
#This program will find all the compound words in a long list of words, by
#taking the lexicon of all half-as-many-letters words and checking them against
#the long list.
| random_line_split |
anagramsCalculate.py | from __future__ import print_function
import pandas as pd
import os
#This program will find all the compound words in a long list of words, by
#taking the lexicon of all half-as-many-letters words and checking them against
#the long list.
print(os.getcwd()) #os.chdir() If using within psychopy, might start out in wr... |
if firstHalf in halfLengthWords and secondHalf in halfLengthWords:
print(words['Word'][i])
validWords.append(firstHalf+secondHalf)
#validWordFreq.append(words['frequency'][i])
print(len(validWords),' valid words')
#freqCriterion = 3
#validWordFreq > freqCriterion
#check whether the half ... | print('example firstHalf=',firstHalf,' secondHalf=',secondHalf) | conditional_block |
settings.py | #!/usr/bin/env python
# coding=utf-8
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_... | (key):
site = get_current_site()
site_setting = SiteSetting.query.filter_by(site=site, key=key).order_by('created_time').first()
if site_setting is None:
site_setting = SiteSetting(
site_id=site.id,
key=key,
value=None,
)
form = SettingsForm(obj=site_... | edit | identifier_name |
settings.py | #!/usr/bin/env python
# coding=utf-8
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_... | flash('settings edit error')
return render_template("rpadmin/settings/edit.html", form=form, site_setting=site_setting) | random_line_split | |
settings.py | #!/usr/bin/env python
# coding=utf-8
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_... |
form = SettingsForm(obj=site_setting)
if form.validate_on_submit():
form.populate_obj(site_setting)
db.session.add(site_setting)
db.session.commit()
flash("settings updated", "success")
else:
flash('settings edit error')
return render_template("rpadmin/setti... | site_setting = SiteSetting(
site_id=site.id,
key=key,
value=None,
) | conditional_block |
settings.py | #!/usr/bin/env python
# coding=utf-8
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_... |
@app.route('/<string:key>/edit', methods=['GET', 'POST'])
@login_required
@navbar(level1='settings')
def edit(key):
site = get_current_site()
site_setting = SiteSetting.query.filter_by(site=site, key=key).order_by('created_time').first()
if site_setting is None:
site_setting = SiteSetting(
... | content = {
'site': get_current_site_info(),
}
return render_template('rpadmin/settings/list.html', content=content) | identifier_body |
account_central_journal.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/account_central_journal.rml', parser=journal_print, header='internal')
| random_line_split |
account_central_journal.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
def _get_account(self, data):
if data['model'] == 'account.journal.period':
return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
return super(journal_print,self)._get_account(data)
def _get_fiscalyear(self, data):
if data['mo... | self.cr.execute("SELECT c.symbol as code "\
"FROM res_currency c,account_account as ac "\
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
result = self.cr.fetchone()
if result:
self.account_currency = result[0]
else:
self.account... | identifier_body |
account_central_journal.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
if new_ids:
self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
res = self.cr.fetchall()
self.period_ids, self.journal_ids = zip(*res)
return super(journal_print, self).set_context(objects, data, ids, report_t... | new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
self.query_get_clause = 'AND '
self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
objects = self.pool.get('account.journal.period').browse(s... | conditional_block |
account_central_journal.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | (self, objects, data, ids, report_type=None):
obj_move = self.pool.get('account.move.line')
new_ids = ids
self.query_get_clause = ''
self.target_move = data['form'].get('target_move', 'all')
if (data['model'] == 'ir.ui.menu'):
new_ids = 'active_ids' in data['form'] an... | set_context | identifier_name |
payment.component.js | /**
* Created by Ehbraheem on 17/03/2017.
*/
(function () {
angular
.module("pay.payment")
.component("paymentForm", {
templateUrl : templateUrl,
controller : PaymentController,
bindings: {
price : '<',
product : '<'
... |
PaymentController.$inject = ["$scope", "pay.payment.Pay", "pay.config.APP_CONFIG"];
function PaymentController ($scope, Pay, APP_CONFIG) {
var $ctrl = this;
$ctrl.email = "";
// $ctrl.makePayment = makePayment;
$ctrl.persistDetails = persistDetails;
$ctrl.$onInit = f... | {
return APP_CONFIG.payment_form;
} | identifier_body |
payment.component.js | /**
* Created by Ehbraheem on 17/03/2017.
*/
(function () {
angular
.module("pay.payment")
.component("paymentForm", {
templateUrl : templateUrl,
controller : PaymentController,
bindings: {
price : '<',
product : '<'
... | // formParams.prd = $ctrl.product;
//
// Pay.makePay(formParams).then(
// function () {
// console.log("success");
// },
// handleError
// )
// }
//
// function handleError(response) {... |
// function makePayment() {
// var formParams = APP_CONFIG.paymentParams;
// formParams.email = $ctrl.email;
// formParams.amt = $ctrl.price; | random_line_split |
payment.component.js | /**
* Created by Ehbraheem on 17/03/2017.
*/
(function () {
angular
.module("pay.payment")
.component("paymentForm", {
templateUrl : templateUrl,
controller : PaymentController,
bindings: {
price : '<',
product : '<'
... | () {
console.log("price is",$ctrl.price);
Pay.getOrderId($ctrl.price);
}
function persistDetails() {
console.log("am Called");
var payDetails = {};
payDetails.orderId = $ctrl.orderId;
payDetails.price = $ctrl.price;
pay... | orderId | identifier_name |
preprocess_bert.py | #!/usr/bin/env python3
"""Creates training data for the BERT network training
(noisified + masked gold predictions) using the input corpus.
The masked Gold predictions use Neural Monkey's PAD_TOKEN to indicate
tokens that should not be classified during training.
We only leave `coverage` percent of symbols for classi... |
if __name__ == "__main__":
main()
| line = line.strip().split(" ")
num_samples = int(args.coverage * len(line))
sampled_indices = np.random.choice(len(line), num_samples, False)
output_noisy = list(line)
output_masked = [PAD_TOKEN] * len(line)
for i in sampled_indices:
random_to... | conditional_block |
preprocess_bert.py | #!/usr/bin/env python3
"""Creates training data for the BERT network training
(noisified + masked gold predictions) using the input corpus.
The masked Gold predictions use Neural Monkey's PAD_TOKEN to indicate
tokens that should not be classified during training.
We only leave `coverage` percent of symbols for classi... |
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--input_file", type=str, default="/dev/stdin")
parser.add_argument("--vocabulary", type=str, required=True)
parser.add_argument("--output_prefix", type=str, default=None)
parser.add_argument("--mask_tok... | _log(message, color) | identifier_body |
preprocess_bert.py | #!/usr/bin/env python3
"""Creates training data for the BERT network training
(noisified + masked gold predictions) using the input corpus.
The masked Gold predictions use Neural Monkey's PAD_TOKEN to indicate
tokens that should not be classified during training.
We only leave `coverage` percent of symbols for classi... |
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--input_file", type=str, default="/dev/stdin")
parser.add_argument("--vocabulary", type=str, required=True)
parser.add_argument("--output_prefix", type=str, default=None)
parser.add_argument("--mask_token... |
def log(message: str, color: str = "blue") -> None:
_log(message, color)
| random_line_split |
preprocess_bert.py | #!/usr/bin/env python3
"""Creates training data for the BERT network training
(noisified + masked gold predictions) using the input corpus.
The masked Gold predictions use Neural Monkey's PAD_TOKEN to indicate
tokens that should not be classified during training.
We only leave `coverage` percent of symbols for classi... | (message: str, color: str = "blue") -> None:
_log(message, color)
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--input_file", type=str, default="/dev/stdin")
parser.add_argument("--vocabulary", type=str, required=True)
parser.add_argument("--output... | log | identifier_name |
test_record.py | import unittest
from apel.db.records import Record, InvalidRecordException
class RecordTest(unittest.TestCase):
'''
Test case for Record
'''
# test for public interface
def | (self):
record = Record()
self.assertRaises(InvalidRecordException,
record.set_field, 'Test', 'value')
record._db_fields = ['Test']
record.set_field('Test', 'value')
self.assertEqual(record._record_content['Test'], 'value')
def test_set_all(self)... | test_set_field | identifier_name |
test_record.py | import unittest
from apel.db.records import Record, InvalidRecordException
class RecordTest(unittest.TestCase):
'''
Test case for Record
'''
# test for public interface
def test_set_field(self):
|
def test_set_all(self):
record = Record()
self.assertRaises(InvalidRecordException,
record.set_all, {'Test':'value'})
record._db_fields = ['Test']
record.set_all({'Test':'value'})
self.assertEqual(record._record_content['Test'], 'value')
d... | record = Record()
self.assertRaises(InvalidRecordException,
record.set_field, 'Test', 'value')
record._db_fields = ['Test']
record.set_field('Test', 'value')
self.assertEqual(record._record_content['Test'], 'value') | identifier_body |
test_record.py | import unittest
from apel.db.records import Record, InvalidRecordException
class RecordTest(unittest.TestCase):
'''
Test case for Record
'''
# test for public interface
def test_set_field(self):
record = Record()
self.assertRaises(InvalidRecordException,
... |
record._db_fields = ['Test']
record.set_all({'Test':'value'})
self.assertEqual(record._record_content['Test'], 'value')
def test_get_field(self):
record = Record()
record._db_fields = ['Test']
record._record_content['Test'] = 'value'
self.assertEqual(recor... | self.assertRaises(InvalidRecordException,
record.set_all, {'Test':'value'}) | random_line_split |
test_record.py | import unittest
from apel.db.records import Record, InvalidRecordException
class RecordTest(unittest.TestCase):
'''
Test case for Record
'''
# test for public interface
def test_set_field(self):
record = Record()
self.assertRaises(InvalidRecordException,
... | unittest.main() | conditional_block | |
ag-grid-demo.component.ts | import { Component, OnInit,ViewChild } from '@angular/core';
import { AppService } from '../../app.service';
import {SimpleDataHttpPageComponent} from '../../shared/simple-data-table/simple-data-http-page.component';
@Component({
selector: 'c-ag-grid-demo',
templateUrl: './ag-grid-demo.component.html'
})
export... | (private appService: AppService) {
this.appService.titleEventEmitter.emit("ag-grid示例");
this.columnDefs = [
{ headerName: "Make", field: "make", width: 300 },
{ headerName: "Model", field: "model", width: 300 },
{ headerName: "Price", field: "price", width: 300 },
{ headerName: "aaa", ... | constructor | identifier_name |
ag-grid-demo.component.ts | import { Component, OnInit,ViewChild } from '@angular/core';
import { AppService } from '../../app.service';
import {SimpleDataHttpPageComponent} from '../../shared/simple-data-table/simple-data-http-page.component';
@Component({
selector: 'c-ag-grid-demo',
templateUrl: './ag-grid-demo.component.html'
})
export... |
constructor(private appService: AppService) {
this.appService.titleEventEmitter.emit("ag-grid示例");
this.columnDefs = [
{ headerName: "Make", field: "make", width: 300 },
{ headerName: "Model", field: "model", width: 300 },
{ headerName: "Price", field: "price", width: 300 },
{ head... | random_line_split | |
ag-grid-demo.component.ts | import { Component, OnInit,ViewChild } from '@angular/core';
import { AppService } from '../../app.service';
import {SimpleDataHttpPageComponent} from '../../shared/simple-data-table/simple-data-http-page.component';
@Component({
selector: 'c-ag-grid-demo',
templateUrl: './ag-grid-demo.component.html'
})
export... |
} | {
this.appService.titleEventEmitter.emit("ag-grid示例");
this.columnDefs = [
{ headerName: "Make", field: "make", width: 300 },
{ headerName: "Model", field: "model", width: 300 },
{ headerName: "Price", field: "price", width: 300 },
{ headerName: "aaa", field: "aaa", width: 500 }
];... | identifier_body |
creader.rs | Item) -> Option<CrateInfo> {
match i.node {
ast::ItemExternCrate(ref path_opt) => {
debug!("resolving extern crate stmt. ident: {} path_opt: {:?}",
i.ident, path_opt);
let name = match *path_opt {
Some(name) => {
... | }
// When the hash is None we're dealing with a top-level dependency
// in which case we may have a specification on the command line for
// this library. Even though an upstream library may have loaded
// something of the same name, we have to make sure it w... |
match hash {
Some(hash) if *hash == data.hash() => { ret = Some(cnum); return }
Some(..) => return,
None => {} | random_line_split |
creader.rs | _string(),
id: ast::DUMMY_NODE_ID,
should_link: false,
});
if ekrate.target_only {
// Need to abort before syntax expansion.
let message = format!("plugin `{}` is not available for triple `{}` \
(only found {})",
... | are_equal_modulo_startpos | identifier_name | |
creader.rs | source = cstore::CrateSource {
dylib: dylib,
rlib: rlib,
cnum: cnum,
};
self.sess.cstore.set_crate_data(cnum, cmeta.clone());
self.sess.cstore.add_used_crate_source(source.clone());
(cnum, cmeta, source)
}
fn is_staged_api(&self, data: &[u8]... | { /* fallthrough */ } | conditional_block | |
creader.rs | Item) -> Option<CrateInfo> {
match i.node {
ast::ItemExternCrate(ref path_opt) => {
debug!("resolving extern crate stmt. ident: {} path_opt: {:?}",
i.ident, path_opt);
let name = match *path_opt {
Some(name) => {
... | let source = self.sess.cstore.get_used_crate_source(cnum).unwrap();
if let Some(locs) = self.sess.opts.externs.get(name) {
let found = locs.iter().any(|l| {
let l = fs::canonicalize(l).ok();
source.dylib.as_ref().map(|p| &p.0) == l.as_ref()... | {
let mut ret = None;
self.sess.cstore.iter_crate_data(|cnum, data| {
if data.name != name { return }
match hash {
Some(hash) if *hash == data.hash() => { ret = Some(cnum); return }
Some(..) => return,
None => {}
}
... | identifier_body |
async_utils.rs | // Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Virtio device async helper functions.
use std::cell::RefCell;
use std::rc::Rc;
use anyhow::{Context, Result};
use base::Event;
use cros_async::{E... |
Ok(())
}
| {
// No resample event; park the future.
let () = futures::future::pending().await;
} | conditional_block |
async_utils.rs | // Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Virtio device async helper functions.
use std::cell::RefCell;
use std::rc::Rc;
use anyhow::{Context, Result};
use base::Event;
use cros_async::{E... | }
Ok(())
} | // No resample event; park the future.
let () = futures::future::pending().await; | random_line_split |
async_utils.rs | // Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Virtio device async helper functions.
use std::cell::RefCell;
use std::rc::Rc;
use anyhow::{Context, Result};
use base::Event;
use cros_async::{E... |
/// Async task that resamples the status of the interrupt when the guest sends a request by
/// signalling the resample event associated with the interrupt.
pub async fn handle_irq_resample(ex: &Executor, interrupt: Rc<RefCell<Interrupt>>) -> Result<()> {
// Clone resample_evt if interrupt has one.
// This is... | {
let event_async = EventAsync::new(event.0, ex).context("failed to create EventAsync")?;
let _ = event_async.next_val().await;
Ok(())
} | identifier_body |
async_utils.rs | // Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Virtio device async helper functions.
use std::cell::RefCell;
use std::rc::Rc;
use anyhow::{Context, Result};
use base::Event;
use cros_async::{E... | (ex: &Executor, interrupt: Rc<RefCell<Interrupt>>) -> Result<()> {
// Clone resample_evt if interrupt has one.
// This is a separate block so that we do not hold a RefCell borrow across await.
let resample_evt = if let Some(resample_evt) = interrupt.borrow().get_resample_evt() {
let resample_evt = r... | handle_irq_resample | identifier_name |
ChannelContentsWithData.ts | /* tslint:disable */
/* eslint-disable */
// @generated | // ====================================================
// GraphQL query operation: ChannelContentsWithData
// ====================================================
export interface ChannelContentsWithData_channel_can {
__typename: "ChannelCan";
add_to: boolean | null;
reorder_connections: boolean | null;
add_t... | // This file was automatically generated and should not be edited.
| random_line_split |
2e171e6198e6_add_data_migration_table.py | # 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 2 of the License, or
# (at your option) any later version.
"""Add data_migration table
Revision ID: 2e171e6198e6
Revises: 15d3fad... |
def downgrade():
op.drop_table('data_migration')
| op.create_table('data_migration',
Column('id', Integer, primary_key=True),
Column('name', Unicode(255), nullable=False, unique=True),
Column('finish_time', DateTime),
mysql_engine='InnoDB') | identifier_body |
2e171e6198e6_add_data_migration_table.py | # 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 2 of the License, or
# (at your option) any later version.
"""Add data_migration table
Revision ID: 2e171e6198e6
Revises: 15d3fad... | ():
op.create_table('data_migration',
Column('id', Integer, primary_key=True),
Column('name', Unicode(255), nullable=False, unique=True),
Column('finish_time', DateTime),
mysql_engine='InnoDB')
def downgrade():
op.drop_table('data_migration')
| upgrade | identifier_name |
2e171e6198e6_add_data_migration_table.py | # 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 2 of the License, or
# (at your option) any later version.
"""Add data_migration table
Revision ID: 2e171e6198e6
Revises: 15d3fad... | from alembic import op
from sqlalchemy import Column, Integer, Unicode, DateTime
def upgrade():
op.create_table('data_migration',
Column('id', Integer, primary_key=True),
Column('name', Unicode(255), nullable=False, unique=True),
Column('finish_time', DateTime),
mysq... | revision = '2e171e6198e6'
down_revision = '15d3fad78656'
| random_line_split |
app.js | import React from 'react'
import {
Container,
Group,
TabBar,
Icon,
Badge,
amStyles,
} from 'amazeui-touch'
import {Link} from 'react-router'
class App extends React.Component{
propsType ={
children:React.PropTypes.node
}
render(){ | ...props
} = this.props;
let transition = children.props.transition || 'sfr'
return (
<Container direction="column">
<Container
transition={transition}
>
{children}
</Container>
... | let {
location,
params,
children, | random_line_split |
app.js | import React from 'react'
import {
Container,
Group,
TabBar,
Icon,
Badge,
amStyles,
} from 'amazeui-touch'
import {Link} from 'react-router'
class App extends React.Component{
propsType ={
children:React.PropTypes.node
}
| (){
let {
location,
params,
children,
...props
} = this.props;
let transition = children.props.transition || 'sfr'
return (
<Container direction="column">
<Container
transition={transition}
... | render | identifier_name |
app.js | import React from 'react'
import {
Container,
Group,
TabBar,
Icon,
Badge,
amStyles,
} from 'amazeui-touch'
import {Link} from 'react-router'
class App extends React.Component{
propsType ={
children:React.PropTypes.node
}
render() | active = {location.pathname === '/'}
icon = 'home'
title = '首页'
to='/'
/>
<TabBar.Item
component={Link}
active={location.pathname ==... | {
let {
location,
params,
children,
...props
} = this.props;
let transition = children.props.transition || 'sfr'
return (
<Container direction="column">
<Container
transition={transition}
... | identifier_body |
profiling_support.rs | Default::default() }
}
}
struct QueryKeyStringBuilder<'p, 'c, 'tcx> {
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
string_cache: &'c mut QueryKeyStringCache,
}
impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
fn new(
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
... | let dis;
let end_index;
match def_key.disambiguated_data.data {
DefPathData::CrateRoot => {
crate_name = self.tcx.crate_name(def_id.krate).as_str();
name = &*crate_name;
dis = "";
end_index = 3;
}
... | {
if let Some(&string_id) = self.string_cache.def_id_cache.get(&def_id) {
return string_id;
}
let def_key = self.tcx.def_key(def_id);
let (parent_string_id, start_index) = match def_key.parent {
Some(parent_index) => {
let parent_def_id = DefId {... | identifier_body |
profiling_support.rs | : Default::default() }
}
}
struct QueryKeyStringBuilder<'p, 'c, 'tcx> {
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
string_cache: &'c mut QueryKeyStringCache,
}
impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
fn new(
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
... | // efficient query keys.
fn def_id_to_string_id(&mut self, def_id: DefId) -> StringId {
if let Some(&string_id) = self.string_cache.def_id_cache.get(&def_id) {
return string_id;
}
let def_key = self.tcx.def_key(def_id);
let (parent_string_id, start_index) = match de... | }
// The current implementation is rather crude. In the future it might be a
// good idea to base this on `ty::print` in order to get nicer and more | random_line_split |
profiling_support.rs | Default::default() }
}
}
struct QueryKeyStringBuilder<'p, 'c, 'tcx> {
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
string_cache: &'c mut QueryKeyStringCache,
}
impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
fn new(
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
... | (
&self,
builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
) -> StringId {
builder.def_id_to_string_id(DefId { krate: LOCAL_CRATE, index: self.local_def_index })
}
}
impl<T: SpecIntoSelfProfilingString> SpecIntoSelfProfilingString for WithOptConstParam<T> {
fn spec_to_self_profile_st... | spec_to_self_profile_string | identifier_name |
decode_pose.ts | /**
* @license
* Copyright 2019 Google LLC. 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 a... | scoresBuffer: TensorBuffer3D, offsets: TensorBuffer3D, outputStride: number,
displacements: TensorBuffer3D, offsetRefineStep = 2): Keypoint {
const [height, width] = scoresBuffer.shape;
// Nearest neighbor interpolation for the source->target displacements.
const sourceKeypointIndices = getStridedIndexNe... | function traverseToTargetKeypoint(
edgeId: number, sourceKeypoint: Keypoint, targetKeypointId: number, | random_line_split |
decode_pose.ts | /**
* @license
* Copyright 2019 Google LLC. 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 a... |
/**
* We get a new keypoint along the `edgeId` for the pose instance, assuming
* that the position of the `idSource` part is already known. For this, we
* follow the displacement vector from the source to target part (stored in
* the `i`-t channel of the displacement tensor). The displaced keypoint
* vector is r... | {
return {
y: clamp(Math.round(point.y / outputStride), 0, height - 1),
x: clamp(Math.round(point.x / outputStride), 0, width - 1)
};
} | identifier_body |
decode_pose.ts | /**
* @license
* Copyright 2019 Google LLC. 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 a... |
}
// Decode the part positions downwards in the tree, following the forward
// displacements.
for (let edge = 0; edge < numEdges; ++edge) {
const sourceKeypointId = childToParentEdges[edge];
const targetKeypointId = parentToChildEdges[edge];
if (instanceKeypoints[sourceKeypointId] &&
!inst... | {
instanceKeypoints[targetKeypointId] = traverseToTargetKeypoint(
edge, instanceKeypoints[sourceKeypointId], targetKeypointId, scores,
offsets, outputStride, displacementsBwd);
} | conditional_block |
decode_pose.ts | /**
* @license
* Copyright 2019 Google LLC. 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 a... | (
edgeId: number, point: Vector2D, displacements: TensorBuffer3D): Vector2D {
const numEdges = displacements.shape[2] / 2;
return {
y: displacements.get(point.y, point.x, edgeId),
x: displacements.get(point.y, point.x, numEdges + edgeId)
};
}
function getStridedIndexNearPoint(
point: Vector2D, ou... | getDisplacement | identifier_name |
permission.rs | use std::{error::Error as StdError, fmt, io::Write, str::FromStr};
use diesel::{backend::Backend, deserialize, serialize, sql_types::Text};
#[derive(AsExpression, Clone, Copy, Debug, Eq, FromSqlRow, Hash, PartialEq)]
#[sql_type = "Text"]
pub enum Permission {
MakePost,
MakeMediaPost,
MakeComment,
Foll... | (&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Failed to parse Permission")
}
}
impl StdError for PermissionParseError {
fn description(&self) -> &str {
"Failed to parse Permission"
}
fn cause(&self) -> Option<&StdError> {
None
}
}
| fmt | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.