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 |
|---|---|---|---|---|
test_unit_tilde.py | import pytest
from conftest import assert_bash_exec
@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
class TestUnitTilde:
def test_1(self, bash):
assert_bash_exec(bash, "_tilde >/dev/null")
def test_2(self, bash):
"""Test environment non-pollution, detected at teardown."""
... | (self, bash, part_full_user):
"""~part should complete to ~full."""
part, full = part_full_user
self._test_part_full(bash, part, full)
| test_5 | identifier_name |
test_unit_tilde.py | import pytest
from conftest import assert_bash_exec
@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
class TestUnitTilde:
def test_1(self, bash):
assert_bash_exec(bash, "_tilde >/dev/null")
def test_2(self, bash):
"""Test environment non-pollution, detected at teardown."""
... |
def _test_part_full(self, bash, part, full):
res = (
assert_bash_exec(
bash,
'_tilde "~%s"; echo "${COMPREPLY[@]}"' % part,
want_output=True,
)
.strip()
.split()
)
assert res
assert res[... | """Test for https://bugs.debian.org/766163"""
assert_bash_exec(bash, "_tilde ~-o") | identifier_body |
test_unit_tilde.py | import pytest
from conftest import assert_bash_exec
@pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
class TestUnitTilde:
def test_1(self, bash):
assert_bash_exec(bash, "_tilde >/dev/null")
def test_2(self, bash):
"""Test environment non-pollution, detected at teardown."""
... | want_output=True,
)
.strip()
.split()
)
assert res
assert res[0] == "~%s" % full
def test_4(self, bash, part_full_user):
"""~full should complete to ~full unmodified."""
_, full = part_full_user
self._test_part_full... | assert_bash_exec(
bash,
'_tilde "~%s"; echo "${COMPREPLY[@]}"' % part, | random_line_split |
main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# by Mafarricos
# email: MafaStudios@gmail.com
# Thanks to enen92 and fightnight
# 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... | ():
kidsyoutube.CATEGORIESyou()
# kidsyoutube.addDir('Kids Youtube',siteurl,13,addonfolder+artfolder+'iconKyou.png',True,1,'',maxresults,startindex,'')
# videosinfantis.addDir('Videos Infantis',siteurl,4,addonfolder+artfolder+'iconVI.png',True)
# ogatodasbotas.addDir('O Gato das Botas',siteurl2,5,addonfolder+artfolder... | CATEGORIES | identifier_name |
main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# by Mafarricos
# email: MafaStudios@gmail.com
# Thanks to enen92 and fightnight
# 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... | selfAddon = xbmcaddon.Addon(id=addon_id)
addonfolder = selfAddon.getAddonInfo('path')
artfolder = '/resources/img/'
siteurl = 'http://videosinfantis.pt/'
siteurl2 = 'http://videos.ogatodasbotas.com/'
siteurl3 = 'http://canalpanda.pt/'
##################################################
#MENUS
def CATEGORIES():
kidsy... | import kidsyoutube
addon_id = 'plugin.video.videosinfantis' | random_line_split |
main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# by Mafarricos
# email: MafaStudios@gmail.com
# Thanks to enen92 and fightnight
# 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... |
return param
params=get_params()
url=None
name=None
mode=None
iconimage=None
maxresults=None
startindex=None
try: url=urllib.unquote_plus(params["url"])
except: pass
try: name=urllib.unquote_plus(params["name"])
except: pass
try: mode=int(params["mode"])
except: pass
try: ico... | splitparams={}
splitparams=pairsofparams[i].split('=')
if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] | conditional_block |
main.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# by Mafarricos
# email: MafaStudios@gmail.com
# Thanks to enen92 and fightnight
# 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... |
params=get_params()
url=None
name=None
mode=None
iconimage=None
maxresults=None
startindex=None
try: url=urllib.unquote_plus(params["url"])
except: pass
try: name=urllib.unquote_plus(params["name"])
except: pass
try: mode=int(params["mode"])
except: pass
try: iconimage=urllib.unquote_plus(params["iconimage"])
except... | param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'): params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}... | identifier_body |
mode.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... | (mode: Mode) -> Self {
match mode {
Mode::Off => ClientMode::Off,
Mode::Dark(timeout) => ClientMode::Dark(Duration::from_secs(timeout)),
Mode::Passive(timeout, alarm) => ClientMode::Passive(Duration::from_secs(timeout), Duration::from_secs(alarm)),
Mode::Active => ClientMode::Active,
}
}
}
| from | identifier_name |
mode.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... | Mode::Passive(timeout, alarm) => ClientMode::Passive(Duration::from_secs(timeout), Duration::from_secs(alarm)),
Mode::Active => ClientMode::Active,
}
}
} | Mode::Off => ClientMode::Off,
Mode::Dark(timeout) => ClientMode::Dark(Duration::from_secs(timeout)), | random_line_split |
mode.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... |
}
| {
match mode {
Mode::Off => ClientMode::Off,
Mode::Dark(timeout) => ClientMode::Dark(Duration::from_secs(timeout)),
Mode::Passive(timeout, alarm) => ClientMode::Passive(Duration::from_secs(timeout), Duration::from_secs(alarm)),
Mode::Active => ClientMode::Active,
}
} | identifier_body |
colorHelper.ts | /*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restric... | * If no explicit color or default color has been set then the color is
* allocated from the color scale for this series.
*/
public getColorForSeriesValue(objects: DataViewObjects, fieldIds: powerbi.data.SQExpr[], value: string): string {
return (this.fillProp && DataViewOb... | * Gets the color for the given series value. | random_line_split |
colorHelper.ts | /*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restric... | bjects: DataViewObjects, fieldIds: powerbi.data.SQExpr[], value: string): string {
return (this.fillProp && DataViewObjects.getFillColor(objects, this.fillProp))
|| this.defaultDataPointColor
|| this.colors.getColorScaleByKey(SQExprShortSerializer.serializeArray(fieldIds || [... | tColorForSeriesValue(o | identifier_name |
timeout-panel.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
private _updateTimeoutInfo(): Promise<void> {
this._lastQueryTime = Date.now();
return TimeoutManager.getTimeout()
.then((timeoutInfo) => {
this._timeoutInfo = timeoutInfo;
this._updateTimeoutDisplay();
});
}
private _updateTimeoutDisplay(): void {
const timeoutI... | {
return TimeoutManager.setTimeoutEnabled(true)
.then(() => this._updateTimeoutInfo());
} | identifier_body |
timeout-panel.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | }
private _updateTimeoutInfo(): Promise<void> {
this._lastQueryTime = Date.now();
return TimeoutManager.getTimeout()
.then((timeoutInfo) => {
this._timeoutInfo = timeoutInfo;
this._updateTimeoutDisplay();
});
}
private _updateTimeoutDisplay(): void {
const timeo... | return TimeoutManager.setTimeoutEnabled(true)
.then(() => this._updateTimeoutInfo()); | random_line_split |
timeout-panel.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | else {
this._timeoutText = 'Idle timeout is disabled';
}
this._runTimer();
}
/**
* Runs the timer that updates our display and occasionally queries the timeout API.
*/
private _runTimer() {
if (this._updateTimer) {
window.clearTimeout(this._updateTimer);
this._updateTimer = ... | {
let secondsRemaining = Math.floor((timeoutInfo.expirationTime - Date.now()) / 1000);
if (secondsRemaining < 0) {
secondsRemaining = 0;
}
const roundedSecondsRemaining = TimeoutManager.roundToApproximateTime(secondsRemaining);
const maybeAbout = (roundedSecondsRemaining !== second... | conditional_block |
timeout-panel.ts | /*
* Copyright 2017 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | (): void {
const timeoutInfo = this._timeoutInfo;
this._timeoutControlsEnabled = this._isOpen && (timeoutInfo.secondsRemaining > 0);
this._timeoutEnabled = timeoutInfo.enabled;
if (this._timeoutEnabled) {
let secondsRemaining = Math.floor((timeoutInfo.expirationTime - Date.now()) / 1000);
if... | _updateTimeoutDisplay | identifier_name |
fixed_bug_11.rs | /*!
* # Expected behaviour:
* The top cube will fall asleep while the bottom cube goes right at constant speed.
*
* # Symptoms:
* Bothe cube fall asleep at some point.
*
* # Cause:
* There was no way of customizing the deactivation threshold.
*
* # Solution:
* Rigid bodies now have a `set_deactivation_thresh... | */
rb.set_deactivation_threshold(Some(0.5));
rb.append_translation(&Vec2::new(0.0, 3.0));
world.add_body(rb);
/*
* Set up the testbed.
*/
let mut testbed = Testbed::new(world);
testbed.run();
}
| {
/*
* World
*/
let mut world = World::new();
world.set_gravity(Vec2::new(0.0, 0.0));
/*
* Create the box that will be deactivated.
*/
let rad = 1.0;
let geom = Cuboid::new(Vec2::new(rad, rad));
let mut rb = RigidBody::new_dynamic(geom, 1.0, 0.3, 0.5);
rb.set_l... | identifier_body |
fixed_bug_11.rs | /*!
* # Expected behaviour:
* The top cube will fall asleep while the bottom cube goes right at constant speed.
*
* # Symptoms:
* Bothe cube fall asleep at some point.
*
* # Cause:
* There was no way of customizing the deactivation threshold.
*
* # Solution:
* Rigid bodies now have a `set_deactivation_thresh... | /*
* Create the box that will not be deactivated.
*/
rb.set_deactivation_threshold(Some(0.5));
rb.append_translation(&Vec2::new(0.0, 3.0));
world.add_body(rb);
/*
* Set up the testbed.
*/
let mut testbed = Testbed::new(world);
testbed.run();
} | random_line_split | |
fixed_bug_11.rs | /*!
* # Expected behaviour:
* The top cube will fall asleep while the bottom cube goes right at constant speed.
*
* # Symptoms:
* Bothe cube fall asleep at some point.
*
* # Cause:
* There was no way of customizing the deactivation threshold.
*
* # Solution:
* Rigid bodies now have a `set_deactivation_thresh... | () {
/*
* World
*/
let mut world = World::new();
world.set_gravity(Vec2::new(0.0, 0.0));
/*
* Create the box that will be deactivated.
*/
let rad = 1.0;
let geom = Cuboid::new(Vec2::new(rad, rad));
let mut rb = RigidBody::new_dynamic(geom, 1.0, 0.3, 0.5);
rb.se... | main | identifier_name |
personaltypes.py | ############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | # This is a place to add your own dumpers for testing purposes.
# Any contents here will be picked up by GDB and LLDB based
# debugging in Qt Creator automatically. This code is not used
# when debugging with CDB on Windows.
# NOTE: This file will get overwritten when updating Qt Creator.
#
# To add dumpers that don't... | ############################################################################
| random_line_split |
pipe.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
pub fn raw(&self) -> libc::c_int { self.0.raw() }
pub fn fd(&self) -> &FileDesc { &self.0 }
}
| {
self.0.write(buf)
} | identifier_body |
pipe.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | else {
Err(io::Error::last_os_error())
}
}
impl AnonPipe {
pub fn from_fd(fd: libc::c_int) -> AnonPipe {
let fd = FileDesc::new(fd);
fd.set_cloexec();
AnonPipe(fd)
}
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
pub fn wr... | {
Ok((AnonPipe::from_fd(fds[0]), AnonPipe::from_fd(fds[1])))
} | conditional_block |
pipe.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (fd: libc::c_int) -> AnonPipe {
let fd = FileDesc::new(fd);
fd.set_cloexec();
AnonPipe(fd)
}
pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
pub fn r... | from_fd | identifier_name |
pipe.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
pub fn raw(&self) -> libc::c_int { self.0.raw() }
pub fn fd(&self) -> &FileDesc { &self.0 }
} | random_line_split | |
orders.js | 'use strict'
const {Product, Review, User, Category, Tag, Order, Address, LineItem} = require('APP/db')
const Promise = require('bluebird')
const {assertAdminOrSelfForOrder, mustBeLoggedIn} = require('APP/server/auth.filters.js')
module.exports = require('express').Router()
// fetch all of the orders for admin ord... | include: [{model: Address}]}]})
.then(order => res.json(order))
.catch(next)
})
// update the status of the order
.put('/:id', assertAdminOrSelfForOrder, (req, res, next) => {
req.order.update(req.body)
.then(updatedOrder => res.json(updatedOrder))
// Order.update(req.body, {where: {i... | { include: [{model: LineItem, include: {model: Product}}, {model: User, | random_line_split |
virer.py | # -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | else:
gouvernail.virer_tribord(personnage, orientation, True)
yield SignalRepete(1)
| nail.virer_babord(personnage, orientation, True)
| conditional_block |
virer.py | # -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | (Ordre):
"""Ordre virer.
Cet ordre demande au matelot de faire virer le navire sur bâbord
ou tribord en fonction du besoin, jusqu'à ce qu'il soit dans une certaine
direction. Le matelot ciblé doit tenir le gouvernail.
"""
cle = "virer"
etats_autorises = ("tenir_gouvernail", )
def __i... | Virer | identifier_name |
virer.py | # -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | def executer(self):
"""Exécute l'ordre : vire sur bâbord."""
navire = self.navire
matelot = self.matelot
personnage = matelot.personnage
salle = personnage.salle
direction = self.direction
nav_direction = navire.direction.direction
if not hasattr(salle,... | re.__init__(self, matelot, navire, direction)
self.direction = direction
| identifier_body |
virer.py | # -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
# | # modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions a... | # Redistribution and use in source and binary forms, with or without | random_line_split |
ignore-all-the-things.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 ... | {a: int, b: int, c: int, d: int}
pub fn main() {
let Foo(..) = Foo(5, 5, 5, 5);
let Foo(..) = Foo(5, 5, 5, 5);
let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5};
//let (..) = (5, 5, 5, 5);
//let Foo(a, b, ..) = Foo(5, 5, 5, 5);
//let Foo(.., d) = Foo(5, 5, 5, 5);
//let (a, b, ..) = (5, 5, 5, 5);
... | Bar | identifier_name |
ignore-all-the-things.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 ... |
}
match [5, 5, 5, 5] {
[a, .., b] => { }
}
match [5, 5, 5] {
[..] => { }
}
match [5, 5, 5] {
[a, ..] => { }
}
match [5, 5, 5] {
[.., a] => { }
}
match [5, 5, 5] {
[a, .., b] => { }
}
}
| { } | conditional_block |
ignore-all-the-things.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 ... | }
} | random_line_split | |
scribe.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::num::NonZeroU64;
use anyhow::anyhow;
use bookmarks_types::BookmarkName;
use changesets::ChangesetsRef;
use chrono::Utc;
use conte... | repo: &(impl RepoIdentityRef + ChangesetsRef),
bookmark: Option<&BookmarkName>,
changesets_and_changed_files_count: Vec<ScribeCommitInfo>,
commit_scribe_category: Option<&str>,
) {
let queue = match commit_scribe_category {
Some(category) if !category.is_empty() => {
LogToScribe:... | random_line_split | |
scribe.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::num::NonZeroU64;
use anyhow::anyhow;
use bookmarks_types::BookmarkName;
use changesets::ChangesetsRef;
use chrono::Utc;
use conte... |
}
pub async fn log_commit_to_scribe(
ctx: &CoreContext,
category: &str,
container: &(impl RepoIdentityRef + ChangesetsRef),
changeset: &BonsaiChangeset,
bubble: Option<BubbleId>,
) {
let changeset_id = changeset.get_changeset_id();
let changed_files = ChangedFilesInfo::new(changeset);
... | {
ctx.scuba()
.clone()
.log_with_msg("Failed to log pushed commits", Some(format!("{}", err)));
} | conditional_block |
scribe.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::num::NonZeroU64;
use anyhow::anyhow;
use bookmarks_types::BookmarkName;
use changesets::ChangesetsRef;
use chrono::Utc;
use conte... | (
ctx: &CoreContext,
category: &str,
container: &(impl RepoIdentityRef + ChangesetsRef),
changeset: &BonsaiChangeset,
bubble: Option<BubbleId>,
) {
let changeset_id = changeset.get_changeset_id();
let changed_files = ChangedFilesInfo::new(changeset);
log_commits_to_scribe_raw(
c... | log_commit_to_scribe | identifier_name |
lib.rs | fn compute_kmp_table(word: &String) -> Vec<i32> {
let mut table : Vec<i32> = vec![0; word.len()];
let mut pos = 2;
let mut cnd = 0;
let word_chars : Vec<char> = word.chars().collect::<Vec<char>>();
table[0] = -1;
table[1] = 0;
while pos < word.len() {
if word_chars[pos - 1] ==... | () {
let word : String = "ABCDABD".to_string();
let text : String = "ABC ABCDAB ABCDABCDABDE".to_string();
let expected_res : usize = 15;
let res : usize = kmp_serch(&word, &text);
assert_eq!(res, expected_res);
} | kmp_serch_1 | identifier_name |
lib.rs | fn compute_kmp_table(word: &String) -> Vec<i32> {
let mut table : Vec<i32> = vec![0; word.len()];
let mut pos = 2;
let mut cnd = 0;
let word_chars : Vec<char> = word.chars().collect::<Vec<char>>();
table[0] = -1;
table[1] = 0;
while pos < word.len() {
if word_chars[pos - 1] ==... | }
table
}
fn kmp_serch(word: & String, text: & String) -> usize {
let mut m : usize = 0;
let mut i : usize = 0;
let table : Vec<i32> = compute_kmp_table(&word);
let text_len : usize = text.len();
let word_len : usize = word.len();
let word_chars : Vec<char> = word.chars().collect::<Ve... | cnd = (table[cnd]) as usize;
} else {
table[pos] = 0;
pos += 1;
} | random_line_split |
lib.rs | fn compute_kmp_table(word: &String) -> Vec<i32> {
let mut table : Vec<i32> = vec![0; word.len()];
let mut pos = 2;
let mut cnd = 0;
let word_chars : Vec<char> = word.chars().collect::<Vec<char>>();
table[0] = -1;
table[1] = 0;
while pos < word.len() {
if word_chars[pos - 1] ==... | } else {
i = 0;
m += 1;
}
}
}
text_len // no match found
}
#[test]
fn compute_kmp_table_test_1() {
let word : String = "ABCDABD".to_string();
let expected_res : Vec<i32> = vec![-1, 0, 0, 0, 0, 1, 2];
let res : Vec<i32> = compute_kmp_... | {
let mut m : usize = 0;
let mut i : usize = 0;
let table : Vec<i32> = compute_kmp_table(&word);
let text_len : usize = text.len();
let word_len : usize = word.len();
let word_chars : Vec<char> = word.chars().collect::<Vec<char>>();
let text_chars : Vec<char> = text.chars().collect::<Vec<ch... | identifier_body |
parsley.js | ('undefined' === typeof element)
throw new Error('You must give an element');
if ('undefined' !== typeof parsleyFormInstance && 'ParsleyForm' !== parsleyFormInstance.__class__)
throw new Error('Parent instance must be a ParsleyForm instance');
return this.init($(element), options, parsleyFo... | window.ParsleyUI = 'function' === typeof ParsleyUtils.get(window, 'ParsleyConfig.ParsleyUI') ?
| random_line_split | |
Video.js | import React from 'react'
import { ScrollView, StyleSheet, View } from 'react-native'
import { Video as ExpoVideo } from 'expo'
import VideoPlayer from '@expo/videoplayer'
import { Ionicons } from '@expo/vector-icons'
import PropTypes from 'prop-types'
import { Colors } from 'constants'
const styles = StyleSheet.crea... | color={Colors.tintColor}
style={{ textAlign: 'center' }}
/>
)
return (
<View style={styles.container}>
<ScrollView style={styles.container}>
<VideoPlayer
videoProps={{
isLooping: true,
isMuted: true,
repeat: true,
shouldPla... | const Video = ( { uri, shouldPlay } ) => {
const icon = ( name, size = 36 ) => () => (
<Ionicons
name={name}
size={size} | random_line_split |
calc_average_windspeed.py | #from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typhoon_file_name = 'typhoon_melor_edited.shp/WindSpeed.shp'
output_file_... |
total_area = 0
total_speed = 0
for part in part_list:
speed = float(part['speed'][:-4])
total_area += part['area']
total_speed += (part['area'] * speed)
return total_speed / total_area
t0 = time.time()
with collection(admin_file_name, 'r') as admin_file:
output_schema = {'... | return 0.0 | conditional_block |
calc_average_windspeed.py | #from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typhoon_file_name = 'typhoon_melor_edited.shp/WindSpeed.shp'
output_file_... |
t0 = time.time()
with collection(admin_file_name, 'r') as admin_file:
output_schema = {'geometry': 'Polygon', 'properties': {u'OBJECTID': 'int', u'Mun_Code': 'str', u'average_speed': 'float'}}
with collection(output_file_name, 'w', "ESRI Shapefile", output_schema, crs=from_epsg(4326)) as output_file:
... | if len(part_list) == 0:
return 0.0
total_area = 0
total_speed = 0
for part in part_list:
speed = float(part['speed'][:-4])
total_area += part['area']
total_speed += (part['area'] * speed)
return total_speed / total_area | identifier_body |
calc_average_windspeed.py | #from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typhoon_file_name = 'typhoon_melor_edited.shp/WindSpeed.shp'
output_file_... | return total_speed / total_area
t0 = time.time()
with collection(admin_file_name, 'r') as admin_file:
output_schema = {'geometry': 'Polygon', 'properties': {u'OBJECTID': 'int', u'Mun_Code': 'str', u'average_speed': 'float'}}
with collection(output_file_name, 'w', "ESRI Shapefile", output_schema, crs=from... | total_speed = 0
for part in part_list:
speed = float(part['speed'][:-4])
total_area += part['area']
total_speed += (part['area'] * speed) | random_line_split |
calc_average_windspeed.py | #from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typhoon_file_name = 'typhoon_melor_edited.shp/WindSpeed.shp'
output_file_... | (part_list):
if len(part_list) == 0:
return 0.0
total_area = 0
total_speed = 0
for part in part_list:
speed = float(part['speed'][:-4])
total_area += part['area']
total_speed += (part['area'] * speed)
return total_speed / total_area
t0 = time.time()
with collection(... | get_average | identifier_name |
main.js | /**
* @file ui/core/styleguide/index//html/01-body/40-main/main.js
* @description Listeners on the body, iframe, and rightpull bar.
*/
/* istanbul ignore if */
if (typeof window === 'object') {
document.addEventListener('DOMContentLoaded', () => {
const $orgs = FEPPER_UI.requerio.$orgs;
const {
uiFns... |
else {
vpWidthNew += e.pageX - uiProps.sgRightpull.posX;
}
if (vpWidthNew > uiProps.minViewportWidth) {
uiFns.sizeIframe(vpWidthNew, false);
}
}
});
// Handle letting go of rightpull bar after dragging to resize.
$orgs['#patternlab-body'].on('mous... | {
vpWidthNew += 2 * (e.pageX - uiProps.sgRightpull.posX);
} | conditional_block |
main.js | /**
* @file ui/core/styleguide/index//html/01-body/40-main/main.js
* @description Listeners on the body, iframe, and rightpull bar.
*/
/* istanbul ignore if */
if (typeof window === 'object') {
document.addEventListener('DOMContentLoaded', () => {
const $orgs = FEPPER_UI.requerio.$orgs;
const {
uiFns... |
if (vpWidthNew > uiProps.minViewportWidth) {
uiFns.sizeIframe(vpWidthNew, false);
}
}
});
// Handle letting go of rightpull bar after dragging to resize.
$orgs['#patternlab-body'].on('mouseup', function () {
uiProps.sgRightpull.posX = null;
uiProps.sgRightpull.v... | else {
vpWidthNew += e.pageX - uiProps.sgRightpull.posX;
} | random_line_split |
mode.js | /* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of sou... |
indent += "* ";
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
return this.$... | {
indent += " ";
} | conditional_block |
mode.js | /* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of sou... | regex : "\\/\\/.*$"
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment.start", // multi line comment
regex : "\\/\\*",
next : "comment"
}, {
... | {
token : "comment", | random_line_split |
where_clauses_in_functions.rs | // Copyright 2017 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 ... | {} | identifier_body | |
where_clauses_in_functions.rs | // Copyright 2017 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 ... |
// compile-flags: -Zborrowck=mir
#![allow(dead_code)]
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32)
where
'a: 'b,
{
(x, y)
}
fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
foo(x, y)
//~^ ERROR unsatisfied lifetime constraints
}
fn main() {} | // option. This file may not be copied, modified, or distributed
// except according to those terms. | random_line_split |
where_clauses_in_functions.rs | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32)
where
'a: 'b,
{
(x, y)
}
fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
foo(x, y)
//~^ ERROR unsatisfied lifetime constraints
}
fn main() {}
| foo | identifier_name |
ide-fetcher.py | #!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip do... | finally:
return ide_asset
if __name__ == '__main__':
# First argument is the version
asset = run(sys.argv[1])
print asset | else:
sys.exit('Failed to find the release: {0}'.format(pv))
| random_line_split |
ide-fetcher.py | #!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip do... | (pv):
RELEASES_URL = 'http://api.github.com/repos/RedhawkSDR/redhawk/releases'
ide_asset = ''
try:
releases = json.loads(urllib2.urlopen(RELEASES_URL).read())
releases = [r for r in releases if r['tag_name'] == pv]
if releases:
ide_asset = handle_release_assets(releases[0... | run | identifier_name |
ide-fetcher.py | #!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip do... |
return download_asset('downloads', assets[0]['browser_download_url'])
def run(pv):
RELEASES_URL = 'http://api.github.com/repos/RedhawkSDR/redhawk/releases'
ide_asset = ''
try:
releases = json.loads(urllib2.urlopen(RELEASES_URL).read())
releases = [r for r in releases if r['tag_name'] =... | sys.exit('Found too many IDE assets matching that description...?') | conditional_block |
ide-fetcher.py | #!/usr/bin/python
# Author: Thomas Goodwin <btgoodwin@geontech.com>
import urllib2, json, os, sys, re
def download_asset(path, url):
|
def handle_release_assets(assets):
assets = [ asset for asset in assets if re.match(r'redhawk-ide.+?(?=x86_64)', asset['name'])]
if not assets:
sys.exit('Failed to find the IDE asset')
elif len(assets) > 1:
sys.exit('Found too many IDE assets matching that description...?')
return down... | asset_path = None
try:
file_name = os.path.basename(url)
asset_path = os.path.join(path, file_name)
if os.path.exists(asset_path):
# Skip downloading
asset_path = None
else:
if not os.path.exists(path):
os.makedirs(path)
... | identifier_body |
edit.py | """Edit the RWhois data on the account."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
import click
@click.command()
@click.option('--abuse', help='Set the abuse email address')
@click.option('--address1', help='Update th... | update['private_residence'] = True
check = [x for x in update.values() if x is not None]
if not check:
raise exceptions.CLIAbort(
"You must specify at least one field to update.")
mgr.edit_rwhois(**update)
| """Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = {
'abuse_email': abuse,
'address1': address1,
'address2': address2,
'company_name': company,
'city': city,
'country': country,
'first_name': firstname,
... | identifier_body |
edit.py | """Edit the RWhois data on the account."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
import click
@click.command()
@click.option('--abuse', help='Set the abuse email address')
@click.option('--address1', help='Update th... | 'abuse_email': abuse,
'address1': address1,
'address2': address2,
'company_name': company,
'city': city,
'country': country,
'first_name': firstname,
'last_name': lastname,
'postal_code': postal,
'state': state,
'private_residence':... | lastname, postal, public, state):
"""Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = { | random_line_split |
edit.py | """Edit the RWhois data on the account."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
import click
@click.command()
@click.option('--abuse', help='Set the abuse email address')
@click.option('--address1', help='Update th... | (env, abuse, address1, address2, city, company, country, firstname,
lastname, postal, public, state):
"""Edit the RWhois data on the account."""
mgr = SoftLayer.NetworkManager(env.client)
update = {
'abuse_email': abuse,
'address1': address1,
'address2': address2,
'c... | cli | identifier_name |
edit.py | """Edit the RWhois data on the account."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
import click
@click.command()
@click.option('--abuse', help='Set the abuse email address')
@click.option('--address1', help='Update th... |
check = [x for x in update.values() if x is not None]
if not check:
raise exceptions.CLIAbort(
"You must specify at least one field to update.")
mgr.edit_rwhois(**update)
| update['private_residence'] = True | conditional_block |
index.tests.tsx | // @ts-expect-error STRICTNESS_MIGRATION --- 🚨 Unsafe legacy code 🚨 Please delete this and fix any type errors if you have time 🙏
import { shallow } from "enzyme"
import React from "react"
import "react-native"
import { renderWithLayout } from "app/tests/renderWithLayout"
import { GlobalStoreProvider } from "app/s... | it("renders the ZeroState when there are no sales", () => {
const auctions = shallow(
// @ts-expect-error STRICTNESS_MIGRATION --- 🚨 Unsafe legacy code 🚨 Please delete this and fix any type errors if you have time 🙏
<SalesFragmentContainer {...props} sales={{ edges: [] } as any} me={null} />
)
expect(a... | random_line_split | |
Timer.tsx | import * as React from 'react';
import {Component} from 'react';
import Task from '../model/Task';
import HidingElement from './HidingElement';
import Bind from './utilities/binderUtility';
// require('!style-loader!css-loader!sass-loader!./main.scss');
const style = require('./main.scss');
// import style from './mai... | @Bind()
private toggleInterval(pause?: boolean) {
if(this.props.activeTask.name === '') {
return;
}
let intervalID = null;
if(!this.state.runningIntervalID) {
intervalID = setInterval(() => {
this.setState({seconds: this.state.seconds -... | private withLeadingZeros(value: number, length: number): string {
return new Array(Math.max(length - value.toString().length + 1, 0)).join('0') + value;
}
| random_line_split |
Timer.tsx |
import * as React from 'react';
import {Component} from 'react';
import Task from '../model/Task';
import HidingElement from './HidingElement';
import Bind from './utilities/binderUtility';
// require('!style-loader!css-loader!sass-loader!./main.scss');
const style = require('./main.scss');
// import style from './ma... |
}
}
public shouldComponentUpdate(nextProps: Readonly<TimerProps>, nextState: Readonly<TimerState>, nextContext: any): boolean {
return nextState.seconds != this.state.seconds
|| nextProps.activeTask.name != this.props.activeTask.name
|| nextState.runningInter... | {
this.toggleInterval();
} | conditional_block |
Timer.tsx |
import * as React from 'react';
import {Component} from 'react';
import Task from '../model/Task';
import HidingElement from './HidingElement';
import Bind from './utilities/binderUtility';
// require('!style-loader!css-loader!sass-loader!./main.scss');
const style = require('./main.scss');
// import style from './ma... |
@Bind()
private toggleInterval(pause?: boolean) {
if(this.props.activeTask.name === '') {
return;
}
let intervalID = null;
if(!this.state.runningIntervalID) {
intervalID = setInterval(() => {
this.setState({seconds: this.state.seconds... | {
return new Array(Math.max(length - value.toString().length + 1, 0)).join('0') + value;
} | identifier_body |
Timer.tsx |
import * as React from 'react';
import {Component} from 'react';
import Task from '../model/Task';
import HidingElement from './HidingElement';
import Bind from './utilities/binderUtility';
// require('!style-loader!css-loader!sass-loader!./main.scss');
const style = require('./main.scss');
// import style from './ma... | (nextProps: Readonly<TimerProps>, nextState: Readonly<TimerState>, nextContext: any): boolean {
return nextState.seconds != this.state.seconds
|| nextProps.activeTask.name != this.props.activeTask.name
|| nextState.runningIntervalID != this.state.runningIntervalID;
}
pu... | shouldComponentUpdate | identifier_name |
lib.rs | warn(single_use_lifetimes))]
#![doc(test(
no_crate_inject,
attr(
deny(warnings, rust_2018_idioms, single_use_lifetimes),
allow(dead_code, unused_assignments, unused_variables)
)
))]
#[cfg(feature = "alloc")]
extern crate alloc;
use core::ops::DerefMut;
use core::pin::Pin;
use core::task::... | (self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
}
impl<T> Sink<T> for alloc::collections::VecDeque<T> {
type Error = Infallible;
fn poll_ready(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
... | poll_close | identifier_name |
lib.rs | warn(single_use_lifetimes))]
#![doc(test(
no_crate_inject,
attr(
deny(warnings, rust_2018_idioms, single_use_lifetimes),
allow(dead_code, unused_assignments, unused_variables)
)
))]
#[cfg(feature = "alloc")]
extern crate alloc;
use core::ops::DerefMut;
use core::pin::Pin;
use core::task::... | ///
/// Implementations of `poll_ready` and `start_send` will usually involve
/// flushing behind the scenes in order to make room for new messages.
/// It is only necessary to call `poll_flush` if you need to guarantee that
/// *all* of the items placed into the `Sink` have been sent.
///
/... | /// underlying object takes place asynchronously. **You *must* use
/// `poll_flush` or `poll_close` in order to guarantee completion of a
/// send**. | random_line_split |
lib.rs | (single_use_lifetimes))]
#![doc(test(
no_crate_inject,
attr(
deny(warnings, rust_2018_idioms, single_use_lifetimes),
allow(dead_code, unused_assignments, unused_variables)
)
))]
#[cfg(feature = "alloc")]
extern crate alloc;
use core::ops::DerefMut;
use core::pin::Pin;
use core::task::{Cont... |
fn start_send(self: Pin<&mut Self>, item: T) -> Result<(), Self::Error> {
// TODO: impl<T> Unpin for Vec<T> {}
unsafe { self.get_unchecked_mut() }.push(item);
Ok(())
}
fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>>... | {
Poll::Ready(Ok(()))
} | identifier_body |
reducer.spec.js | import * as actions from './actions'
import reducer from './reducer'
const INITIAL_STATE = {
stage: null,
twoFactorActive: null,
secret: null,
username: null, | describe('sso-login-detail', () => {
describe('modules', () => {
describe('reducer', () => {
test('should create a valid initial state', () => {
expect(reducer(undefined, {})).to.deep.equal(INITIAL_STATE)
})
test('should handle an action', () => {
const stateBefore = INITIAL_STA... | setupSuccessful: null
}
| random_line_split |
tshirt-outline.js | import React from 'react'
import Icon from 'react-icon-base'
const IoTshirtOutline = props => ( | <Icon viewBox="0 0 40 40" {...props}>
<g><path d="m11.4 6.7l-8.1 2.4 0.8 2.5 3.1-0.3 3-0.4-0.2 3-1.1 19.9h17.2l-1.1-19.9-0.2-3 3 0.4 3.1 0.3 0.8-2.5-8.1-2.4c-0.5 0.6-1 1.1-1.6 1.5-1.2 0.8-2.7 1.2-4.5 1.2-2.7-0.1-4.6-0.9-6.1-2.7z m11.1-2.9l12.5 3.7-2.5 6.9-5-0.6 1.3 22.5h-22.5l1.2-22.5-5 0.6-2.5-6.9 12.5-3.7... | random_line_split | |
dictionary.controller.ts | /*
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requi... | () {
this.$mdDialog
.show({
controller: 'DialogConfirmController',
controllerAs: 'ctrl',
template: require('../../../components/dialog/confirmWarning.dialog.html'),
clickOutsideToClose: true,
locals: {
title: 'Are you sure you want to delete this dictionary?',... | delete | identifier_name |
dictionary.controller.ts | /*
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requi... |
this.query = {
limit: 10,
page: 1,
total: (this.initialDictionary && this.initialDictionary.properties && Object.keys(this.initialDictionary.properties).length) || 0,
};
}
getPropertiesPage = (reverse: boolean) => {
const properties = this.dictProperties
.sort((entry, entry2) =... | this.updateMode = this.dictionary && this.dictionary.id;
this.initialDictionary = _.cloneDeep(this.dictionary);
this.dictProperties = this.computeProperties(); | random_line_split |
dictionary.controller.ts | /*
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requi... |
}
delete() {
this.$mdDialog
.show({
controller: 'DialogConfirmController',
controllerAs: 'ctrl',
template: require('../../../components/dialog/confirmWarning.dialog.html'),
clickOutsideToClose: true,
locals: {
title: 'Are you sure you want to delete this... | {
this.DictionaryService.update(this.dictionary).then((response) => {
this.NotificationService.show('Dictionary ' + this.dictionary.name + ' has been updated');
this.dictionary = response.data;
this.dictProperties = this.computeProperties();
});
} | conditional_block |
dictionary.controller.ts | /*
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requi... |
saveProperties() {
this.DictionaryService.update(this.dictionary).then((response) => {
this.NotificationService.show('Properties has been updated');
this.dictionary = response.data;
this.dictProperties = this.computeProperties();
});
}
toggleSelectAll(selectAll) {
if (selectAll) {... | {
_.forEach(this.selectedProperties, (v, k) => {
if (v) {
this.deleteProperty(k);
delete this.selectedProperties[k];
}
});
} | identifier_body |
small_vector.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | OneIterator(..) => {
let mut replacement = ZeroIterator;
mem::swap(&mut self.repr, &mut replacement);
match replacement {
OneIterator(v) => Some(v),
_ => unreachable!()
}
}
ManyIte... | ZeroIterator => None, | random_line_split |
small_vector.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
#[test]
fn test_expect_one_one() {
assert_eq!(1, SmallVector::one(1).expect_one(""));
assert_eq!(1, SmallVector::many(vec!(1)).expect_one(""));
}
}
| {
SmallVector::many(vec!(1, 2)).expect_one("");
} | identifier_body |
small_vector.rs | // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | () {
assert_eq!(1, SmallVector::one(1).expect_one(""));
assert_eq!(1, SmallVector::many(vec!(1)).expect_one(""));
}
}
| test_expect_one_one | identifier_name |
variable_mgr_util.py | all_reduce.
assert grad_has_inf_nan is not None
update_op = tf.cond(
grad_has_inf_nan,
update_op_if_nan_or_inf,
update_op_if_no_nan_or_inf,
name='cond_if_grad_has_inf_nan'
)
training_ops.append(update_op)
# To be used with custom_getter on tf.get_variable.
class Overri... | # apply_gradients.
return get_op
else:
# For other shadow variables, | if trainable:
# For trainable variables, they are managed separatedly through | random_line_split |
variable_mgr_util.py | (self.sizes), key=operator.itemgetter(1))
device_name = self.devices[device_index]
self.sizes[device_index] += size
kwargs['caching_device'] = device_name
var = getter(*args, **kwargs)
return var
# To be used with custom_getter on tf.get_variable. Ensures the created variable
# is in LOCAL_VA... | avail_devices = [benchmark_cnn.param_server_device] | conditional_block | |
variable_mgr_util.py | _reduce.
assert grad_has_inf_nan is not None
update_op = tf.cond(
grad_has_inf_nan,
update_op_if_nan_or_inf,
update_op_if_no_nan_or_inf,
name='cond_if_grad_has_inf_nan'
)
training_ops.append(update_op)
# To be used with custom_getter on tf.get_variable.
class OverrideCa... | (self):
"""The read access of this variable. The content from the staging buffer."""
return self.var_stage_get
def _ref(self):
"""Return the underlying variable ref, required by tf.colocate_with."""
return self.real_var._ref() # pylint: disable=protected-access
def read_value(self):
"""Mimics... | _value | identifier_name |
variable_mgr_util.py | _reduce.
assert grad_has_inf_nan is not None
update_op = tf.cond(
grad_has_inf_nan,
update_op_if_nan_or_inf,
update_op_if_no_nan_or_inf,
name='cond_if_grad_has_inf_nan'
)
training_ops.append(update_op)
# To be used with custom_getter on tf.get_variable.
class OverrideCa... |
def _ref(self):
"""Return the underlying variable ref, required by tf.colocate_with."""
return self.real_var._ref() # pylint: disable=protected-access
def read_value(self):
"""Mimics tf.Variable.read_value()."""
return tf.identity(self.var_stage_get, name='read')
@property
def dtype(self):
... | """The read access of this variable. The content from the staging buffer."""
return self.var_stage_get | identifier_body |
taskstore.rs | 015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library 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; version
// 2.1 of the License.
//
// This library is distributed in... | <R: BufRead>(&'a self, mut r: R) -> Result<FileLockEntry<'a>> {
let mut line = String::new();
r.read_line(&mut line).chain_err(|| TEK::UTF8Error)?;
self.retrieve_task_from_string(line)
}
/// Retrieve a task from a String. The String is expected to contain the JSON-representation of
... | retrieve_task_from_import | identifier_name |
taskstore.rs | 015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library 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; version
// 2.1 of the License.
//
// This library is distributed in... |
/// Get a task from an UUID.
///
/// If there is no task with this UUID, this returns `Ok(None)`.
fn get_task_from_uuid(&'a self, uuid: Uuid) -> Result<Option<FileLockEntry<'a>>> {
ModuleEntryPath::new(format!("taskwarrior/{}", uuid))
.into_storeid()
.and_then(|store_id... | {
import_task(s.as_str())
.map_err(|_| TE::from_kind(TEK::ImportError))
.map(|t| t.uuid().clone())
.and_then(|uuid| self.get_task_from_uuid(uuid))
.and_then(|o| match o {
None => Ok(Err(s)),
Some(t) => Ok(Ok(t)),
})
... | identifier_body |
taskstore.rs | 2015, 2016 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library 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; version
// 2.1 of the License.
//
// This library is distributed i... | use libimagstore::storeid::{IntoStoreId, StoreIdIterator};
use module_path::ModuleEntryPath;
use error::TodoErrorKind as TEK;
use error::TodoError as TE;
use error::Result;
use error::ResultExt;
/// Task struct containing a `FileLockEntry`
pub trait TaskStore<'a> {
fn import_task_from_reader<R: BufRead>(&'a self,... | use task_hookrs::task::Task as TTask;
use task_hookrs::import::{import_task, import_tasks};
use libimagstore::store::{FileLockEntry, Store}; | random_line_split |
simple.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn maybe_yield(~self, _cur_task: ~Task) { fail!() }
fn spawn_sibling(~self, _cur_task: ~Task, _opts: TaskOpts, _f: proc()) {
fail!()
}
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> { None }
fn stack_bounds(&self) -> (uint, uint) { fail!() }
fn wrap(~self) -> ~Any { fail!() ... | { fail!() } | identifier_body |
simple.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (~self) -> ~Any { fail!() }
}
pub fn task() -> ~Task {
let mut task = ~Task::new();
task.put_runtime(~SimpleTask {
lock: LittleLock::new(),
awoken: false,
} as ~Runtime);
return task;
}
| wrap | identifier_name |
simple.rs | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | impl Runtime for SimpleTask {
// Implement the simple tasks of descheduling and rescheduling, but only in
// a simple number of cases.
fn deschedule(mut ~self, times: uint, mut cur_task: ~Task,
f: |BlockedTask| -> Result<(), BlockedTask>) {
assert!(times == 1);
let me = &m... | random_line_split | |
main.rs | use std::rc::Rc;
fn main() {
println!("Rust ownership system achieves memory safety");
println!("ownership, borrowing and lifetimes");
// META
// Rust focus: speed & safety
// through zero-cost abstractions
// ownership system at compile time | // {
// int *x = malloc(sizeof(int));
// *x = 5;
// free(x);
// }
// malloc allocates some memory, free deallocates the memory.
// thus bookkeeping about allocating the right amount of memory.
// Rust combines these 2 aspects of memory allocation into concept
// called o... |
// Fighting with the borrow checker
// programmer mental model mismatch with actual Rust rules
// Tracking memory allocations & deallocations | random_line_split |
main.rs | use std::rc::Rc;
fn main() {
println!("Rust ownership system achieves memory safety");
println!("ownership, borrowing and lifetimes");
// META
// Rust focus: speed & safety
// through zero-cost abstractions
// ownership system at compile time
// Fighting with the borrow checker
// pro... | {
name: String,
}
struct Wheel {
size: i32,
owner: Rc<Car>,
}
{
let car = Car { name: "MB".to_string() };
let car_owner = Rc::new(car);
for _ in 0..4 {
Wheel { size: 360, owner: car_owner.clone() };
}
}
// We can't do this ... | Car | identifier_name |
main.rs | use std::rc::Rc;
fn main() {
println!("Rust ownership system achieves memory safety");
println!("ownership, borrowing and lifetimes");
// META
// Rust focus: speed & safety
// through zero-cost abstractions
// ownership system at compile time
// Fighting with the borrow checker
// pro... |
// Rust: 'lifetime elision' which allows not to write
// lifetimes in certain circumstances.
//
// lifetime1 - without eliding lifetimes
fn lifetime2<'a>(num: &'a mut i32) {
*num += 1
}
// 'a is called a lifetime
// lifetime2<'a> - declares one lifetime, it is possible to specif... | {
*num += 1
} | identifier_body |
main.js | $(function() {
//搜索框交互
var
placeholder = window.INPUT_PLACEHOLDER || '请输入要搜索的关键词',
baiduUrl = 'http://www.baidu.com/s?wd=',
googleUrl = 'http://www.google.com.hk/search?q=',
searchEl = $('#search');
$('.button', searchEl).on('click', function(e) {
v... | le+'</b>';
var curIndex = 0;
function showHotWord() {
var html = titleStr;
for(var i=curIndex; i<KeywordConfig.num+curIndex; i++) {
if(KeywordConfig.data[i]) {
html += '<a href="'+KeywordConfig.data[i].url+'" class="website" tar... | }, 200, function() {
highlightCatalog(target);
catalogAnimationRunning = false;
});
}
e.preventDefault();
});
//热门关键字
(function() {
var hotWordCtn = $('#content .tips .hot-words');
var titleStr = '<b>'+Keyw... | conditional_block |
main.js | $(function() {
//搜索框交互
| searchEl = $('#search');
$('.button', searchEl).on('click', function(e) {
var
keyword = $('.keyword', searchEl).val(),
url = e.target.name == 'baidu' ? baiduUrl : googleUrl;
window.open(url + encodeURIComponent(keyword));
... | var
placeholder = window.INPUT_PLACEHOLDER || '请输入要搜索的关键词',
baiduUrl = 'http://www.baidu.com/s?wd=',
googleUrl = 'http://www.google.com.hk/search?q=',
| random_line_split |
main.js | $(function() {
//搜索框交互
var
placeholder = window.INPUT_PLACEHOLDER || '请输入要搜索的关键词',
baiduUrl = 'http://www.baidu.com/s?wd=',
googleUrl = 'http://www.google.com.hk/search?q=',
searchEl = $('#search');
$('.button', searchEl).on('click', function(e) {
v... | Config.data[i].url+'" class="website" target="_blank"><strong>'+KeywordConfig.data[i].kw+'</strong></a>';
}
}
hotWordCtn.empty().append(html);
curIndex += KeywordConfig.num;
if(curIndex >= KeywordConfig.data.length) {
cu... | ="'+Keyword | identifier_name |
main.js | $(function() {
//搜索框交互
var
placeholder = window.INPUT_PLACEHOLDER || '请输入要搜索的关键词',
baiduUrl = 'http://www.baidu.com/s?wd=',
googleUrl = 'http://www.google.com.hk/search?q=',
searchEl = $('#search');
$('.button', searchEl).on('click', function(e) {
v... | return;
}
var keyword = $(e.target).attr('href').slice(1);
var target = $('section[data-catalog="'+keyword+'"]');
if(target[0] && !catalogAnimationRunning) {
catalogAnimationRunning = true;
var top = target.offset().top... | ty:0.1},200, function(){
// $(this).animate({opacity:1}, 200);
// });
// }
/*效果2*/
target.addClass('highlight');
setTimeout(function() {
target.removeClass('highlight');
}, 800);
/*效果3*/
// target.addCla... | identifier_body |
version-check.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... |
if __name__ == '__main__':
main()
| conf = cfg.ConfigOpts()
common_config.parse(conf, sys.argv[1:], prog='version-check')
if conf.debug:
LOG.setLevel(logging.DEBUG)
retrieve_local_versions(conf)
retrieve_upstream_versions()
compare_versions() | identifier_body |
version-check.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | (candidate, reference):
return pkg_resources.parse_version(candidate) > \
pkg_resources.parse_version(reference)
def diff_link(project, old_ref, new_ref):
return "https://github.com/openstack/{}/compare/{}...{}".format(
project, old_ref, new_ref)
def compare_versions():
up_to_date = True... | more_recent | identifier_name |
version-check.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... |
from kolla.common import config as common_config
logging.basicConfig(format="%(message)s")
LOG = logging.getLogger('version-check')
# Filter list for non-projects
NOT_PROJECTS = [
'nova-novncproxy',
'nova-spicehtml5proxy',
'openstack-base',
'profiles'
]
TARBALLS_BASE_URL = 'http://tarballs.openstack... | sys.path.insert(0, PROJECT_ROOT) | conditional_block |
version-check.py | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | # Filter list for non-projects
NOT_PROJECTS = [
'nova-novncproxy',
'nova-spicehtml5proxy',
'openstack-base',
'profiles'
]
TARBALLS_BASE_URL = 'http://tarballs.openstack.org'
VERSIONS = {'local': dict()}
def retrieve_upstream_versions():
upstream_versions = dict()
for project in VERSIONS['local... |
logging.basicConfig(format="%(message)s")
LOG = logging.getLogger('version-check')
| random_line_split |
setup.py | from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as... | # the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.0.1',
description='''API with functions to execute SQL queries or re index solr.''',
long_description=long_description,
# The project's main homepage.
url='https... | # Versions should comply with PEP440. For a discussion on single-sourcing | random_line_split |
animation_builder.js | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate... |
/**
* Creates a new CSS Animation
* @returns {CssAnimationBuilder}
*/
css() { return new CssAnimationBuilder(this.browserDetails); }
};
AnimationBuilder = __decorate([
Injectable(),
__metadata('design:paramtypes', [BrowserDetails])
], AnimationBuilder);
| {
this.browserDetails = browserDetails;
} | identifier_body |
animation_builder.js | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate... | () { return new CssAnimationBuilder(this.browserDetails); }
};
AnimationBuilder = __decorate([
Injectable(),
__metadata('design:paramtypes', [BrowserDetails])
], AnimationBuilder);
| css | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.